From 568483c2a85a72e4f740b910141dcd0f2a5cf4bc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0001/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_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/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 01ceb03dc96113465c39d299a180281f10da439f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0769/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 51c6bf2412f29681d894f08a6334dd9e72acb619 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0770/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 40b8c75bf92c3c127935dce92b9babab42983978 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0771/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a8202207d299280532bbb944721f72e8a4a8d85d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0772/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f79f6a3ff122d5ff365621f4b2b7c4f90f635ffa Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0773/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dffe000759e23d8f271635641d41e4d029cab46c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0774/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9df4730af7cdbdacea93fd3dcd668feec6ef32df Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0775/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fc113a77b9fd666e4dc7ae6ef7ad133ea3f98a86 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0776/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3b4d664dea7101461e78a9d74db2676293e7de15 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0777/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 126790247e5b862bc96eeeef73c32a4a39b42e81 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0778/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0237b5faa476026f90c56b9ee732407fa963488c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0779/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9af2af15ac1aa67d6c4b596015ddc57d424953bf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0780/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 631256c62b846d7c4ccacfae5790d4abfe4d6e36 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0781/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 35203b53f2e7100b94a9167babd048e2568ee656 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0782/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6ef1f01b06c3f80130a9f4fbebe7cf211b4e7b81 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0783/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a30ba4e7c1609dc57b1ba98b6b7d19e86139cd9e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0784/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0f02b7cc99eaa021499f1d5ae021fd1955e238db Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0785/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7f0b1a27604c1af25ec344bbf75c655199ed9d54 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0786/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7e7fc58d22309eb43d2431f256c1f7d86291cc76 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0787/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 824830bf2cf087dedba9b03c1aa598d33ee3fb11 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0788/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1c8e3ae9f7abc7a180b0626f69cb1a72164266f1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0789/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 89122690b263365773b90b4687261376fa447764 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0790/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c28ac18e68592e8124d8e11ea3f5d8036a80bc8a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0791/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c85d26a3f6f72f77f928d82fa8f0995d7f827374 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0792/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c8a26dd840f8b4b4589d2abf87f89d18f5435a4f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0793/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 324c45cac6735b8f70959da1b672e03d0ed71cea Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0794/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 76199aabe98d10fd140c57de14feb05a38522878 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0795/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 88ebb7326707de338f3862b38e4da03872b18825 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0796/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7041ab4e5841ef93c5bcef881bc83b97d6bdc73d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0797/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b80e61f72738362712a7a6ce42c3a41652b36a45 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0798/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5d05550d46c8da798ee26f97ecadd13dcad99c96 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0799/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 88c597033b6d46bc69b84010988f156cb6f03469 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0800/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7e24447779fd4150f2462604d033a6c1626f31d7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0801/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 29f9f6e7e4d687885a787cb2f6408f2753a45d9a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0802/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3a5132431b7dddd51e72f0812c08349e59da8ed8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0803/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e00d1434ddd9c3e10a980c3025bfcaa87fa97488 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0804/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0731d70d1472c6343790290a81a612116fd7ee5e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0805/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 07b8cd17a195d7562c25e0f7ec078c5561aaff7b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0806/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 679d4c50e16946002ce13181ef0a9ce88aba8296 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0807/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4c0f8629e934dfa79db3ec6f41d23145394a6553 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0808/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b734f11e135ce4c94c8bc04b4d1550a04ef82096 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0809/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fadafa79c84943040baafbf81086761a545b3507 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0810/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 22f7b4bfe016fab0d4ec56a9e17ba26dcd272e60 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0811/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3ffe7eabed724cd8bc604fd947bf8df6e9a338bd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0812/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 301f04e378496f9163ff6fdff8547204e52077b7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0813/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4ec6287e9639b33af93a26f68b5bcd418f572fcf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0814/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 52f1a7e5370db903e52df07c753e9397380074e9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0815/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 75f1198bf47c88e026aae5c8cef61459edbb7133 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0816/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 82f98d36f86e00addd86a89cc591bc4f77756829 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0817/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 42fd1741d03255f0e1b6a74a0280d7539175f426 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0818/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 26bbe8abb914ac025e686304049ed05785954edc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0819/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fbe0c699d4ee16365f0d8f2fa671b08819a6cafc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0820/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5cadfd9308fae3a38e08a1db50ad20dfa825e089 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0821/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a45dc76f29f7bca01bda19ba789c6c02e41fd3af Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0822/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1d25974225094137070aa74c9f09e46297f77a3b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0823/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 600b53f617967286afa4ab03cd31432e9b0867e8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0824/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 28f097dee3e68f7ae0333e8b7a76ed8d60237412 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0825/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0b10b83c9c3ef0771614fc058cbc77ff7a6b1a82 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0826/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From df701e8cc4f03510235f71c8048b075f89f566e6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0827/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8bef48f0a817528a08456d884206e577cfe7f2ba Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0828/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3a31cc170cedd07966cc0bbab3fcd0cf4de7fab8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0829/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6b92220ed85c6157077e7e0479ec9eda1382a664 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0830/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5c916a42d318a15d0327b68cd099e443d6560f81 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0831/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7c581f8b9321b115658d2ddd7315c54978a210e0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0832/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fe4cfc87b1b667c7158a0327492ab03c18cfb8d4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0833/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d517cef1f75cd7dadca261fa14fe59f3012514ff Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0834/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c9042dcb031cdded863308d09c7779daf652a514 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0835/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 24b957e75ae260a15b562dab0c0affcd621fcb40 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0836/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 096503e3064bf68ae05aa808ce40d8ade9e4a93b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0837/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d82c5b7f01c478bb42885fa4d59cc09185973fd2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0838/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 39340aec28c5b099dd0bc81b1ff00692533d48be Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0839/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3eb78925e79c1640ca6f4cb83a6ce573e83c7a1a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0840/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f8505a46ba45f46b93024b7007836695a1bc2f3e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0841/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3682db2d1e1b2281897226191b09d6a11fe4157a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0842/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5a68681701108645c416389695e3e3ff404d5982 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0843/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 36a95af8c9fdc1a76c9b7bfd9b31a7a8c4b6eb04 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0844/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 56b46469fd1470e6754512f61b2d17336df30f84 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0845/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cb720496245b3087be75d109e6f5fd38e88cc60a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0846/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 20777d1969735926e846ce463a6426654834d6ad Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0847/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1ed9548b2aef16c18598d03b8ab6f8e9339982ac Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0848/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2231f31e5e74170d538eab939dc485e493b66719 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0849/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d62f210fbf38ee3c6d5292bc3376bfe87d7a6c1f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0850/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7522aa9333d3a0f34e3ff9256e68c58c5dac2143 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0851/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4f6a6cff9975d5e77f06b34f801d23120c255147 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0852/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3a7793d7e42d6bb85c5e2b7bd973361d417fe750 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0853/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ed79c740b8c4913b20e635a734e32b2a89220671 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0854/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 76a3dc1fd77362de80127296157c44488cf4cf89 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0855/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8b79c8ff7e4620071629650e89934957cf897a54 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0856/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b5a04f69f10876c8e71cf978495d6459cbfc8f09 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0857/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 22ff2291c545b12b0e411747bb1b78924ed721cd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0858/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 55496c5cabcd6990afdeca5289b7208d660f8bf3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0859/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d7a4003c0d341c144ee9aabb3443ead49845f92c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0860/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c07278655dc05846657294acbd4030ba7a6efe4a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0861/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 57971e59e1a09bd347fa1815990817e6175bd4cf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0862/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ef85bad20ccf6156ad621a58d0b590cf81371885 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0863/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cb7253ed925b41112ee2ece8e59c3f174d58b31c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0864/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4e5dac2f42b97d2bd6b4a13ac0826af227d97f3a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0865/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a74fb6cc8c743343587975dccf02c3f0cb4584e2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0866/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 32f078e9a35a143feb7e6e8b6df080e4efafce01 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0867/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a3f4fe153e06f0e2ec408433a50b11ff910f9f71 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0868/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From df1d53f1da985c77a80289e20f04a2a6d20e2cf8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0869/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 09a4efb0558193e9b0bbf0031ea6ec31562df254 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0870/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7f49935fc979d215e11daa659b660ac45e9747e2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0871/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0556b5e8a86b9c182ff5513c18cda8ae6bb6d159 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0872/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 92b08268e8d1ce32c4e567c197ca2d749647206b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0873/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3079c394051d0c41ee9915531f09b97df9764be1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0874/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cb451fca34bf61bf180b41ac57da06b70ee97f7c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0875/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6f87ec8d144264dfaf753c3090d9bf7a23d797e2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0876/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8f8245a489446bbea430cb3b1cda4fd48f2e0640 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0877/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7b77c9df545821638a9b76984b085d59d7aa3b5b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0878/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7fd738f8158e851d6c817f789429402f0e4af33a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0879/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1f381414246d2b9577c64a72de203c9c80c1b4fe Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0880/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dcef599e1ee4fd8ea5c793e1a06f70720b7fe251 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0881/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 05d4ca20b197881759b394c2ae4262191d24c50c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0882/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 18d87135da8f4e86b4eb776a37dc41d5194035cf Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0883/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5fb2adf2e43abc5fc13e3a587fe80d7402663c59 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0884/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b97a4332bf43993459521aeb409829b098851843 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0885/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 439c565ff55f43b164f1f7ff392827833abeb647 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0886/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3e1f4c6dd94559f66d8ba8708fb00b8696ad46b3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0887/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f1b034a5abf6ac120bbbfc9131be4665b3b03621 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0888/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c3c1fc8a8cbe3dac17fa698319f676ec6ccccdd0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0889/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b3e9352ef2f551b2d9f68d721da073d579a87973 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0890/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f68c1f2bff7a71a749567bf65d5608d1c230d82c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0891/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 48cd071d3de007ceeee6b97557a6ac45d62d50d3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0892/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5c57242744a00c9d9020b824658a4cfa491b6f22 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0893/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e21e9e5efc941392fe2216e3b4e6518dc3cbcd4b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0894/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cd4e70655cddc1a1d3094b5b1f22de29040ce37e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0895/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e9288613b8470b1c841252e3b725f7c541384c14 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0896/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 145e886a0491ebdbd745a3dc48f773c3b6ca529b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0897/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 06a9244b3597e7b70a271d508c3161d1294a4aa8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0898/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9177c35a89a1b18517cccff02e7c52d600a1c6ef Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0899/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 53f5502bca4fd2a46bae65903cb3031a5b2aadd1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0900/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d0dad76041d028c9ecf785d82f7d38d64c93bd8a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0901/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c0e82771ab193ee3a52165f082df50c96ae93ec1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0902/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 73d1e84e20d4627b9fd029540bd2a8de89fe94df Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0903/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c1965e85fdfb541dbfd06c8144f05b93a4f8828f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0904/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d8f6d0129dffa3db45a78d8e333633817905b36c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0905/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e8123b0885a7ef9a644e24851086b7161d8b3fa6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0906/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 85d5ece8d018cba77ac72dab73e8518a14698723 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0907/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5f959ec465d57adbb932b74cb47446ba041ff2c7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0908/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dc7f31d47e21921483550d22ec43e1e10d16cac7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0909/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cd7d28d7f15fe57493e2f70ecafa41c49819d5a9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0910/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From df580bdb147721ff920fba287ea5cb8ef02d6380 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0911/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ad0107203f4b8c177809f0106c8f8f2e92b48c32 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0912/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a373739213ba988c805339588b79164dedd13858 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0913/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b87fc1b86bf3e994457df9f7a121449cb8a68825 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0914/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From bf3c345134b8a9f1af9bad76fbae3fa37596b497 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0915/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From df5405442d03d40897bec30d53c9dec317327018 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0916/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3b53e5145c79b0d708a231bde2557974b18d726a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0917/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ae89bbbbe3f9cf2c52257547d89e8170a0bd312d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0918/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 55280e7c1e18453aa2b0bbe7c0d16738c4e5e4e4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0919/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7d386601a6c95c85f526dd88847ba59d9329e966 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0920/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8b4ab925ae1b4af2ed4d1c7cb15714298a0e3eb8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0921/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a6cae27655fce21ddbb177aebfb18f9bbaf25191 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0922/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6de2cfb4311334a0d2fbd8f840db1bb971ef0e60 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0923/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1e13fb7085a1132e98380f35f0f61fceec6e4e21 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0924/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cdc98990529031d8081c201db489095e165dff5b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0925/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4925c8d8e7f92abcea8d89b7f6be4c64cc381b14 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0926/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d42bf2939d8d365c8a0d613ffc3276e2cf5d6148 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0927/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c590d65e4c256c793f878b5e735e47e3529b2fb2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0928/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 79b374a1a5de8f9f1223b022099b2738ba21c853 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0929/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c6b5adb5c77d77e8149df7362949a0909bc52c54 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0930/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8d1d78deec0039e3d2e70f609ed1837022ed41fa Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0931/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b631195f6eb2ab3b3838697f040248d31ce8cb22 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0932/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3e176bf7eea0cd8804600345ef0ee8597003590c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0933/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d7b424185ec607a684144b99ede5f453886e5c9a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0934/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 714bdb3f200351b43d986e478693c8d402d7a7d2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0935/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ac553b74611f8b46e85fd4bdee7536138975b220 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0936/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 961682c7177a8eb0e7ccf581f13b6c85b46320d8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0937/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4d4bfa7b745a3f3e6ec30f10d4999390c613bc4c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0938/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7261371b956c17feef407bd5fec4ba1cf966ab55 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0939/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7bf23689dfb5b48208d31a931e7b529c7ab5f628 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0940/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b57f6de7e5da3f7d08b1901fddce79846520c033 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0941/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dad3af34c48afe013dba69e87f2015c32bcd5d00 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0942/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 76ca4ad11a3e2614f9e628fb801244fcbb0bbbee Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0943/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 28cf7f30e613468b216de41befef542724cf88f2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0944/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 81923226f537b9a5ccc7b90ba12e7704a5f983b5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0945/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 562e92baf2c969ab896b91d722abb1da018c3b70 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0946/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 61ebd55036fba679edf0b07f56c2e124512297dd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0947/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 92e388d9c5bc54e79794461a4f621d4742bf1b09 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0948/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c02eabbef86643c0a2db52fc8eca02c6f929c478 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0949/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 17356217314a8c5dede286c1a60a128baa5b8e96 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0950/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8d4bad9a9f86e740d0e8bfa6b231d9ab5f2c2daa Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0951/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b583d0d43dd56be2089e65639f12363e24ec31f9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0952/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d8f73a49bfe49afa4857f0f476ce26f50c768545 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0953/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 65cc29f9ac080bffd1f038fac8491623058c5f35 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0954/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b6498de74026f93fdfcd186e8343cdcd14259e1d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0955/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f6f350bc7c912248e0080b800c88da246189b253 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0956/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c0e2322ad65cc6534921d7f13281f2ba380c960b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0957/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a7cfc8a24624685b053b78cb8c3e6c08deca4a2e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0958/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3381e12159d715ebd0428e26dfe03363f6f5f611 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0959/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c695a6a1b51e3e0056c512db6ef2b1d4f6ca2b06 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0960/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8817b9114f420c4e3ebc0d092c6dda3812397982 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0961/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 586a07d81fdbad6b821e5153f1abc7c1abec036f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0962/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 44b5e80c6d4816c75a7849bf3a6518d5b77c665f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0963/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5533a92538e1b7a9451de53222ed10e5aa48ef0b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0964/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 06235d57002dbc5392bc234579f46d2ee8d5adfb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0965/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0224139d611aa803871bfa7fa0b243bdc29ca942 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0966/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c0099a27f7ab77d5ae966651bf8dc440c2a22f87 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0967/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0a7f89e1cf33f4129a003571457222f9c7814703 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0968/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9ba07f39d8d883bb4ab84fb89ebc1e793e841d11 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0969/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1b1a6dfd8dc19bed60b3107e07bbd9bdcc4e1ea9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0970/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c0ce2d2872f68b050f698dd66a4ef7dfc124ee80 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0971/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b97cdb27ddb09a3389e15806b058f81d89e0d881 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0972/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7c6753a3b45d669fcaf42ef9aa3acbf068bd9bb9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0973/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a6909e5b183b626b0016895d427baf95c3bd3914 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0974/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9814966d0f282f403a0951f2d196dc78a3e450a2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0975/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4fb148259afaac4c4da826471a0413a6b9f1c8fb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0976/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 304af2295b6ef5d867d02982d6bbce0a77d0a1d7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0977/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 063a5485b35333b297c87efa4b56fc45eee0c075 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0978/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 229d1299ebf2033d465e362b5f1a4c7abfbe454e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0979/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b7852927118b1635908e66d11cc65029db3b9635 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0980/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1f81103f63e6451cb955741640f9d34189a9e567 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0981/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c35c8213734aaf7d9a9a4ad298f1a94e6047ad57 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0982/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 431326988bc433a49db09df546e176460ce7f4b8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0983/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From aaa034b182ba4168a0bdfaf08733b467010cb16f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0984/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cd12131752d356e0de258a685bb0179b1d2337f8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0985/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e1ca84a24fdc1ebdaa7a70807ae0976c58fdccaa Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0986/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 11d850976c3bbea6652105d0aef5c2bcc33d1d71 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0987/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0744636a6523d04c6fd0e7abdc6e42c9158f3091 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0988/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From becc8a9f456239657850545c75f735df366d1d52 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0989/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5aac85c5374a46d5223fa6acc931c032178cd199 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0990/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6b5e683ef60544aa0cfb6b75ea760f02d251a32a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0991/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0d19f7492630d55f9cb9b0fdb835726ddb00916f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0992/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2beb1341fd4d38ddbe1153b37a44fb773eb90114 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0993/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f7b464b591800548c0a2d5c2374d6571bf411267 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0994/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b7e7572e8ad4baecbb54ea40371e02720dd3cb91 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0995/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f29656c778bcac1d66df1193a8fb1a845f8aa9b8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0996/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5483c7851e168644eea770edec2d56edb27d779b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0997/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 65838913bb2164274528a860dc2405db301adb50 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0998/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cfa2315f9675ba6a340a33b4a6b6b6944351b0c7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0999/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6bb553c688292efa2e77e1eb0b3c9019e0408a79 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1000/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 34d438ac03528a619a1f46faf4ec500a0c78c87d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1001/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From aa3661a0451077479b78c2e29ec895dd6803ea2b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1002/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 26ea1fbf07daaf5aeea786ab920e8b25f14ff410 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1003/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 86572461500b8c01dd0639456654c5fd75bdff4a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1004/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 28f382a4d6e35e7ffaeaf0cb1f6b0d21a04d3343 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1005/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 82f47e4421d2d54fb7c6f400c6da9a9d0a69e84f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1006/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e832198ab38384b82f8afaa77383910a8bc33b63 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1007/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e0bb3c4648c96c0825e6a14fe2bb56e6f837886e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1008/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 284226ac2893bacbb9dba6ac2814c95f2fc5761d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1009/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f54b6776c4169ae84499ab3297330b921c397a7e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1010/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cea501a351583eeaca79381f14356732a4bb1a38 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1011/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 75b9547b8ec36cc3d95bfec760de3db605bd0848 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1012/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ec707583f60dd83d7229dfca64c23cdbadac8c2c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1013/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3837e58c3c26a5a8c2b69001993820770b0bd61a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1014/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 246166692c4d8eb3b31d3fd27f42cbdd6ff149a9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1015/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9b4f178d20ebf7c607bb9e0a5e1cb4bee2229427 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1016/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8ac3c58d4757d14a7c5efe89a95050209b275816 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1017/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8b1246b76489a342226f0143b73dd8a7c3567c86 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1018/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8eebcd6d194187d3c486ad60c714f7f37ebbdf4b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1019/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 63797c972c4f82f0839c50217c50e1e571d1cfb6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1020/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 10fe4282e4ee9f901b3b2399fb55eba87f9c28db Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1021/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ca893fe07508c2a6ac3eaaa661788135d68a9cb7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1022/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 81ae02f29dbef086ba3ad17e85cbaea2a5d69048 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1023/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9265c9a019055eeed3dbf97e78b23448376ddae6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1024/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ff1066b30e0526221af7917c5b8fda2e236173c1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1025/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 35d5d56817efff2521b7fdd127f72adb224397ec Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1026/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 250576667521de230d30cd6479254d91b44aa2a3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1027/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f9733206750154a0bd8a9db664d692f8cdd6a546 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1028/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7183f7e0370be760af3da70ccaa8d84cbb8a61e7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1029/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 52cd87b7f5b1b389be2252899041e85cdb8469cd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1030/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From aee9ea029e2b1c47c328e6855c64ea55780f7954 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1031/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 72fb7d991f2af33ef334777c5bc779a1e695d509 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1032/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 95f352a4fe34ba94d8fb02c2ff855fd263eb49ce Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1033/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a90331c359ed1d3f03c724f37e54defbf8d8c40c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1034/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b05bc70dbc058d27336c29c0561992732bc06885 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1035/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 793671491cae7ef576b57813c59ef7b59eadf024 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1036/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7e0700443ec8cc05de06bfe9a2f5f9d8db1086d9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1037/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1cd7fe8d8302b8bdd6ef5b9ab67534e6a526055c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1038/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b4a2a78cd6af7b2ee9122066734c2bad95237de9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1039/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8cdd4c6ad115bf3feaa15cf479ea0bce210ad7b0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1040/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5b7f81926355252de72846df3d34a2188874a4a6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1041/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4a99d1ff217d5cc396652f54a560a4625501b679 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1042/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0d0664a6e4e82ae5c0f1858bfd7b60c5221c150a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1043/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e308e477d7c73f698218749a3357b0a79660151b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1044/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b66f4dfe259fff7b0d11a48893d33e399f66d8b1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1045/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a45e66f1a889c4265b24362e01f77e3ae8db2667 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1046/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ad0bffce70f15c5908ec19cd9443daf241536557 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1047/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3afa4a6dfd0c7da6063f5ffcfa974631650ca0df Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1048/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 436fec50db75e5bbb95cbfd7abd024eddf4345c9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1049/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1e3220db453ab9735fe9a7305cd76873a1119cdd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1050/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6def89c0340b480b592a1efe42f9a58a0d5dbebd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1051/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6673de7fbb01a3669e3a54c35442f639addc2916 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1052/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5ba7163cf4fddd4f2126fea069abb9e6dc2a4269 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1053/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 36dc2cca8b957891b3d911da3ba4c47765edf6bb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1054/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From bc0faecb57d791a9dfd9bb5c430ffadab68426cd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1055/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 078514f3427bfcc4baff227bdd52afd4fdec30bb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1056/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c4cee2b90a9ea2aedcf9559b66bed10c8e11207d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1057/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2f871bb05b6d30d0b58d6d4bfdb4d7bdb11fc21e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1058/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a2ac83b5a120321572a2baf92df9b63b293b8e5a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1059/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From bde4839fd500a592d84d9200ce53849da65ffb8e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1060/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1cb77d303ce054acffdda23ad0f72c25bb19b0c2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1061/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e5bdcd85b233b1131db94270288934cee8830435 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1062/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9a9ea1c8892a993d10934677d2cdffddfb0b0be4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1063/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4944a0f00486e9eb52f2530b640026b838918eba Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1064/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f1477a70e9de4c82c795ccf9a686a837ce05ad68 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1065/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8b519e7c84178ddfc0c87e4b6aec658b7a3503ad Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1066/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 878a2b1b3c51b11b300402089e28ee66d4f0afda Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1067/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cb669df369131c1cfa13bdf76c5821debae36afe Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1068/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cb7787966bd45a7b5df830f022d9e9227a51eaca Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1069/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 432d072fd6aab915a90da8c7f40b221e81e97a1b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1070/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a21f8316949da74e1ba34bc6cfa4ae38ca07e9c5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1071/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a155e2839950d0cb15c419c5d1fd650d0d0da33c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1072/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 152e193151fa91c57c303916c50ab4b8f138f508 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1073/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 89e2e4d0efb4ed847a7ee777eee1064726a7b3f9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1074/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4aed12f197efa7f44e5caa45e266cf2b949ef69a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1075/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 66201315321adb82f6bd9d41e1099cb4d63562d4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1076/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 998d7bd9cf5a19ea0425ca752bbe5c85298cbfbc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1077/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 550662263a5ab23545af2db3bc0949fac36b3d51 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1078/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dfb12c945a509cb63920be91fd929bfbed9539e1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1079/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4a3ffd4c871b65bf48bd506fa23bd8b4cd6585c2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1080/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a02595a5beab0e65ac6017ae9bb0bbcfb14a7cc9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1081/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2913a94c78aee90c3915ef794c96db9289d33ed4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1082/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a8949e264bae0c6be9dadd7e50021fd2a119ac71 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1083/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9950d64da34f5eaec20ce3c9aa7d1663d20b954c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1084/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From db02b695047cbe84e079775d7ecc7830fad81635 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1085/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 00b82028810c94ae63e8968a28bf33028fe8103d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1086/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4adab237ae6a449994f016e4519ba53a819e4de6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1087/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 64448eb69cad51a25bc83cfd94bcc9a2b2921c23 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1088/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 220ced8e47f3312cab4e7e6653e460dddb9a7c91 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1089/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 02d06adc043944e9412b40e76d04b1263711bc4a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1090/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 33c01f8f624f0ad553006214acbd41268513a505 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1091/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 310fd15303c698d5b47bb5030aa3f17a268ce1d2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1092/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From edac682926c6cd650069e532bac11503eb042643 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1093/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1378c5cb26e5a5f8874f69f37ece53e80cc64050 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1094/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 552b1c016e0086b6cc175a0c3fe4ad4d1f3ca517 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1095/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 583ce0f62331b7a4d8eb875dd5192942084f30b0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1096/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dc7b16d31a8b95c17d29a7afe56c2a1f7e60173a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1097/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4157627c16c0aad0dbd2b6b3716bce4731479fd1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1098/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3d473ecb88ae5e014af935a3297fc46fa23970d7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1099/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c9d65b35a5acea7175f665de337cbcbaa464a884 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1100/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1c6867162f889b30f7cece6a3989033cfb29584e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1101/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 06d1d2adfdd7c712673c00224284b0c72fa364b5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1102/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 62bf9692d2a1d989b551e24988f20b927d7ed5b8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1103/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0a064c388d9fefb325f426c8109286cc784a6f79 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1104/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4f077cf5d97e491dc3b6c8da685dc3693d2005fd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1105/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From bec297444a01a4ef2ebb96e349a9031afeae45e5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1106/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From eeef15cc280a29f92f21948d0ede0f9f26a90a13 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1107/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0f97c676e2132486f60951440aad40fe5ba0b426 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1108/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 48b20a1e1b435f1b42b16b67243f009bd93051e0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1109/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5bcb61db612c3f79ad7df09c2894f92e32812209 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1110/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 150020b56c30275bde9cbdb0fd8c1c7d457fe5e4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1111/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c87dfb994b2f47aa4bfc56226c95e943d7e1d347 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1112/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9c4fadaa137d93f4608fe0b0011f38d4a03c64ee Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1113/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9b983a3236f594cceae860fb84207f058b9dd7a6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1114/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8bf146eb9a5fefa92d0f234b2492119babe60b8e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1115/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b46485d401a8fa12a0d2310d2c20b093c042a133 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1116/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cfdd474245aef3c466425909ff60bf05838bd36e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1117/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e86b82ab7f901945cd8f3091a7d4c706e3f217dd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1118/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4795be63ddd5e66ac8a320f4a732182aac7a2cfc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1119/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From aceb58c509ba645ffc6babc9f93ac4f576dac934 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1120/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 19431782f6ab588eb2f55a724332cd6b8b4ec717 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1121/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1edcddf39e0f7f6f21b19d1c4053a7844ca9d020 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1122/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8ab1999bc4660f3199064c364b7a901c926715ee Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1123/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b9fb015978b5f4cae70093403311cb1d39956dc2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1124/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 338c93ee232a9902af3bffb2403db46a0da78649 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1125/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 967583228b077f7ba65ecc0eff27224a1c18ab34 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1126/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e9c45c107c31157576c66088595467fa630e0e61 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1127/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7e58a5b315f5747d7a8f7dc97c5ec4bf2349e993 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1128/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 13859161d72a6877ab7e3d87b4be818b207a590c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1129/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9b7c6589e8136322b0e7b9340e576d01d9076e35 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1130/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 45b3ad7df0db08d81f9cb7fa6c75163cadca7451 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1131/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 801ee00010476bbf01e3b295f62b829aafe4cda5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1132/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 24e2bb68b098c9e1e9242eaf54b23f5956cdd907 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1133/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a996a6b0b575d593535bf90b59b65c6037cdbee4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1134/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2aeb78baf61dfa5e67dc6b027e32fe9c39b7b890 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1135/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ad0035ff8b5c68f9f9024b0debeb0bb2cb101adc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1136/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ad5c4b37a701e85ad1656e6b6a616bd52a1b2f61 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1137/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1a12d23b4e0736e58d73a06a221886abb2db41d1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1138/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 90636c3b1223101d364f8ed529a83033e830cfba Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1139/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c1aed0bdd03c61dfa1a3101a3873703067daebb8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1140/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 619658f9ece33f53b9072b4dbef67b20f7fd857f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1141/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 70f442d6d3097bf05f66bf733aa69f812bafdb51 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1142/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7d31f78d5e283e1be49c9c6744ccbab10218ddc9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1143/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 66ad4ea586018f633cb00fd566df1747a213adc5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1144/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7b7398d80041024185a669f9122af92e173c89b2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1145/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fb8b112f819032d39d9eda21d01e7b7d5b9e543e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1146/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c96d98f8b61feb9f72ff35fa78279f1341c99363 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1147/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 68e4b67753d7f87c41714f4511bb709f51e3b397 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1148/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4731d3e7bc853c17784a5e62105f5bd7e7f13416 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1149/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From be5951be986f97ef0d8cad945126db92b2e1b5bf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1150/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6b7e8067b62ff90042091d662ceff6df75e4645e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1151/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a040b8744332dadcaf4d183b04f2c15999dca909 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1152/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6d4f650baeb15f1be9f739a864e58518292ea5f1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1153/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d9e2284f1c0a25a5c183c540160a10beab4a555e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1154/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 069145b73a4df2806cb3a35b53ff015b12de6dae Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1155/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ef735eb68b792bd95592889bb68e4a3240306ec9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1156/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2e62d1f07965ee3cec02fb873a8322086e9ca457 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1157/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5d6c9f3fa6783e90b1e5d93f1b24c7272f0ef9dc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1158/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fc407f9cb0304fee08d3fbec268ecf8853529dbe Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1159/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2934a9563efbf98a9e34a2f34acff7cc8f9c18cc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1160/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 15396af0fdeca498c58683bb23edaa6567647736 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1161/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8f7b22eab846cff74e38582f10877d0d116bc907 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1162/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 30324033b7d19807e3a3249bd1529a2b44776705 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1163/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a78e870e04ed27d6a084fac5d5bd767320073615 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1164/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c654f03108adf8ebd92d30320bc575fe70f292b4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1165/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d47ad317919abe68e0d90d5975a07c541e17ff49 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1166/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8bfc4d4ddf76a40ae3856175a47f72a525ad82e7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1167/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4322f112e84cd8d4e1967bc8d9ccfcc22174fbc7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1168/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fc2ca8bf1632ee46d25677f3d623143634245325 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1169/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a5dad733d9a46f86c541eda173623c833dffee98 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1170/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6ee837d484f15c5f282ebc3e40d853e733c085fe Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1171/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 73df495f6518279393a6d6237e9c21f50c5ea832 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1172/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6667fac02df8843bb0a17583037d7c9d88b85100 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1173/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9b0953b62d38594ba6485a0de8bdb518fef8a2e9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1174/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 46e995c27a5f2abc21a4e72a1e49f8647091ef77 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1175/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d1ade36155439518565d9b201c9ec2adb19017f3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1176/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 467c60211d023e20d72cb3fa699bf552f7332dca Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1177/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3c49033f9e85deb2e43dc4e544e870d22a0b4930 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1178/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5b27970eeb38e98ba9d1c8d28c10ca64dab80510 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1179/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3ac5b999df458576105b0e39e85a421dce42d5d6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1180/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d1cb2d831ba43ff2aa73310b96400ddb81249ea5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1181/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d4fdf42981ded8153b0c1873708f02bf9db2fb63 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1182/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 609ae1be287b419a4390efd099c0ada78485d87d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1183/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ccae51e21fb4efed36ae3601bb77e903340c95e8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1184/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 172a17a5fc2001b8cb9792ee4e156c90213b2ccf Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1185/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2fb320a806fdaa71550662f58589282581cf9731 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1186/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a86dc95f0614771a38b9003760e445eded87bb2b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1187/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fb26a0c6a08c531329592402e4ca58dd34e812d4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1188/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 63689843a6c8848dcf2549b9ccdcb14a9ef18f0a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1189/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1f9b98b859d95f1cc8d484a62ce1fa690662f72b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1190/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6bc2abea31ed55f05931d7a418633699f74d323b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1191/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d6e4b33c607b8abba348c3981b71bd53dfe5e5fc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1192/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From faa809f53cd2f33343528712910b584d3bd93198 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1193/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4b69cc8d6889caaf9b096b70ad23fbc4481497c4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1194/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b85ed90a1ffa8599e25b5b64fe2a4fa1bbb55f6c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1195/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3d9494946726091172a5940979f4d0f7787d9207 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1196/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7040d78c23e4d6019cafaef3392db24730f659e8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1197/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9c4021e9cd9d9daba655918fbad3f43abd986448 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1198/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 08f222b64eb7c9a0ca53fc8d6f82ee98c803cdbe Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1199/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ca24bebcd5bdb706360f53fc774c0ee87672369c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1200/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2230f623fbfc8cfa5a1466722c6f5b13ee0d9935 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1201/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 61ea605e6f6a8779d3ecf6a83fdd0cb9096ebac4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1202/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1618570ea89fb55f1d3e7a2ba6fe702061c5f975 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1203/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2717079a814f69980466d17309ff4d1044f94e4b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1204/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8a5d6cebc86220325f0a6a04fb984593bbb809cf Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1205/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 099f2d57296cce261e0473e8c123821c73754831 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1206/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c7a82435efd7009aa37b7baef2e7c22b4c43d902 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1207/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2de2644f8c8bb9b7cf83223190dfd5800263f8a1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1208/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 48b6c551012476d767a08b310d3c4558540289ca Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1209/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4b34e4ba7912a21ff06f210684032e2b098bf4fd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1210/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 420bf25d798e61fea5df719820ba7166532bc711 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1211/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b1118ea6101245ed8bbd130f92fde93c51864cdd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1212/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f513e0ec0e72cefc2f41fafe66c3eac604637bb4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1213/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e980cffadc1009a9ea096c877142c24b1d7dc366 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1214/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3d6cc27ef854b14083b5bed4c19072af50af5e0b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1215/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4a8df930af82966e5eb98540ab3b8aafde796ed9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1216/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 032d2d5a571dd4a616d10bced96fa400004213de Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1217/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 49e0dcb4e8737edde0bf8bac242149a9ccab72f1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1218/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 98decc04f9f92c68aadbdc3326f1bd67b5073b10 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1219/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9ee7c26a58a033ad3c37bf4d821e893b45178577 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1220/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2873e4f20db099b25a82b1fabe52c2ab5984157c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1221/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c80fe6ebc4e96954a494dcc30e7d57012039b798 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1222/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9b847f9294ece0789dc58e3f55850c4ba5e543d4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1223/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0f65e4e3089ace6a7cb33a324d60ecd2f24331ab Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1224/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 29d845b37ab9a2994e7f7eb6aa44f17a6f524474 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1225/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a65929a2764f14df52fb52afa3b23af338f76fd4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1226/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0112b65539cc4aedfc6c90249088f7ebe167d2b7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1227/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ac6aabf365b0810f42da1e9ec14288f84bbb3126 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1228/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 440d06246243ce64b7b175556f6434c090672bb2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1229/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From be07bc5a21335928198796265fc77501a7905afc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1230/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4f31e72b12a0a1dab0f265a3d903af16c1c7af77 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1231/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0328bd0c9bad5310d8a96e2c2f0446c1a5963521 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1232/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 89b0b51814edb11956bdd57339c62dbfa6ac4776 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1233/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d9ae2f03a688b2959dbe2db7864849e7a8c2235e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1234/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6f08146714f2848ecd019aff6b823eab6bd15e71 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1235/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 280f406423f8d7f179f4d5d69cf14f0c27ca0dec Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1236/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3ac021ef0843006451fae314c381090b83d3400e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1237/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From be0ea65e98292527bf9d722f7bee193bb6365cb9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1238/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2f4185d12048cb8ed368ed185f6894abc04e2c01 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1239/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d18f992b6072a19388843d62d8c5bb2001e2fdad Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1240/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8f4e75d241729ddd27cd32d6f23610f63ba2ac81 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1241/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 64db388673ea51de30aef34df6b7d5adaf5879b2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1242/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a96416427d636570415523a528eab4707c70b6f4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1243/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b158df09767e6ec998739ab0d07b2b2c4f9614c8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1244/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9ae4c5c990034947653508ef7d2cb5dacff87ac1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1245/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a07bf4a96733e1e13bd9bb5bfbed61779c810308 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1246/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2c42a5d95f69b52737f906ed69649f7293182ce0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1247/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2bd194dfdde6135814740967f0d8fd69d6eefcec Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1248/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ce42efdd29baa654070f872a5d0c871a0d311d62 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1249/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 65e7bcdb7973ecf69def32fd52f50d3be58e9588 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1250/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 38d174717c75443fc87064e63f2866eeec56d7c4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1251/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 21bf5a4c00192e9862dd093a512a89a78d273507 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1252/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2ebb35b0d7423df541591f805e818bdfeb7e3e74 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1253/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ba7bd6bd4f5a173033fc799221b9a1578d83c545 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1254/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 374d3e3e6a574bc84047b5efc35dfb239ca664a1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1255/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a0265b97dabc9e038bb60ced26ba4319091323b1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1256/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fa5942ab60a99f4f886c5811d889d5a14c6db600 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1257/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 500a20a14ebe3a4040d09fc31e5afd26d3d2a2f0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1258/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 69814485373674e863b715bb52792cd40098559f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1259/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6375d31077ef7042eb64b4986ff9bd08050a8e1b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1260/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From bf65cba61ecbc6fb5c18db712af34ccdb5eb661d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1261/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9460c6bb72fec5ed62b0a194dc0b5ef229231a22 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1262/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d281aad55eae69316e0d96b0151a1cefadee7684 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1263/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b032e9cd8061eb650a5ac95e5ad5f8f7d83d6d63 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1264/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 67ec15fd5a641c00fe31570b67d0e6cc31b4a13a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1265/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b245ba30a26e6064b1c5cf6e95ebfc503294b35c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1266/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b1f097a2563c79eac7127e1d2707432c2ae9267e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1267/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4e2c8534d78753cfd55f8f76ef9614e743cad9fd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1268/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c882106cf325d94a0f225a1b5dfc071d0e66e86c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1269/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a0615daf6df62eb8bf4e4e8fc6b5d39a1c5c74fc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1270/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a72b267c12345826efe6a5f2522a361555817292 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1271/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c5d8dd8c781fe62d3d273383a613151c35c20abf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1272/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 21c24e4bef189a2975cf1715ac9b6c67b8e4a684 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1273/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7e74ed9d2528472068f96f7f244ccbd0b5ce3e50 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1274/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 456cd4adccb8eb395264ba4201a059a52bdda547 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1275/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b3288ecaf1a1ef71042a1961ea8cfbbddd907606 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1276/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 076693b88255bc9ddd230e13dfb9e8cbd7d3837c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1277/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c5afa8b6802ef00257ac24057529dace5bb5a0fd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1278/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b0dada1027977f25514fdc8b8dee320bbcc45224 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1279/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 14367c8f49a8d9e1fcfdeff2a5532c7dca51f74a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1280/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 810ee825d7090ca39f926821369280987e00a8a8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1281/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1a0efed5639d3ec6ae2090c9cf6564c6935945f8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1282/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e909ce0c568e67c679db3b00f6f81b3c48f27148 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1283/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7b34319d6a6292ad155c1f86eb99ec9ab2c2a4f2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1284/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8725cff4aac88e4c00466a1ff3536b9ed2a9a605 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1285/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6ded6fe23a2adb23aecb6660e44f7b6513490931 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1286/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6757a1d53f462271cb9edffd9172d20be8008f26 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1287/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4585b21c998780f99dbd358ecbae5b20520943a6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1288/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 93fb3f865aedf1cc04bd1952e4c0fe360d66b6c7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1289/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f7e57d1ea45ddd2a2d058b2a5199071c1a81b867 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1290/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9deaf056bc5e599499c3cb2e5d0711344ea27269 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1291/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 53dddea0d90f774650d4616cd611cb0b0bae0234 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1292/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 946fe6de732f87b42e331b88b00455a51d87037f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1293/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3028a74527202696f9812f827598ee03b9008cca Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1294/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 27aa95c0ec1e62ddf795c17741f9422d587ae7d3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1295/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3efe07edd692ee2b674c45ff060aecee809c416e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1296/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 10eb3d25e36703e9e5d5738495a4aaac171d5082 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1297/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 39c07f497697ac2352d89a02e4a7766a6bdb0710 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1298/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2bfa7c25e89559c7f9088d5922fb6910263a21a0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1299/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2fdb2eab368e19b083987f5023aa5afc0eb30652 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1300/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d81a2c3056304ffa1d1d365216ca74e1eec6f4fe Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1301/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dc5a98fe7542a3bf7c9418c712602cb4eb57f641 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1302/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2a2a64842083bad13b633824b5a0b61552df64e6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1303/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ff8380ae69f72ffbc1d94777db98cfddd024c5a2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1304/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 31b6a90647a8f1faa783f5224707738343529fd0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1305/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a063695a39930d81c567440407c50313b8bf4580 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1306/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From eac8c918a39ed584fbd1198798cd5d7ff5dbd73f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1307/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5528f89860c5208189ba753c96bed3505ee433ef Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1308/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1ea50c0f9c0ab92788f51b2be65823fb1da247a0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1309/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 90f8ca125e1ee83853320b944569a7f182671349 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1310/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ba5c027b7d7af504b5bf2e44452f85a95e17403f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1311/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0d3d961a1e0a772ab5748b4baa1e6b21016962bd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1312/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6c9f3188b3672379847ce628625b74831b9aa5d3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1313/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From eab4537364d6bcb415304efc80471f090e1910c7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1314/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f3f24dbefd1c19b01457ea1a9ba7b90b7889b6d1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1315/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3c91a94959c990bddf0faff4c9f0f2e83501dd79 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1316/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1832eb08ac1763714b80444c1bd20cda9b0c5c02 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1317/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ed4937ab44e499bc4145bc0c5a10f2aedb5b1d34 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1318/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2d186a223dc9d9411c4d2e3db9f4ac27bd44b662 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1319/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c1cc981f71fc292ef4f3b983f7ed9b8fbff110db Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1320/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fc7f25aaab3515ed3dcdffc3a3c940e5ddfee441 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1321/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8d307c76f46ac8a4210541cd0f8a4b7431ede46b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1322/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7ecf4a1d0ab91532888b02022d4373908421416a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1323/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c06281f9ad32de3ab831e4c6314a71d703c1c635 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1324/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5fe19930abb63fc771ed854df6536413c98ee187 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1325/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7df0ecab311a04801b16a6c5ef304eb87578382f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1326/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a81563369bb590977ce1cfc3bcf39bf9d04f4beb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1327/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b683176ee9bccd38bd4aa109ccca7a9d40bb4a8a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1328/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a9765e6a0a683cd753e0c54cd92bfb0680492630 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1329/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From aa28b9d8b2bd8019528adae33e49f85afce82f91 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1330/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From bcf1afc7b0344472d4b0503275b3749fd7d10288 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1331/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7343dbbe6290e7d58f6e4634643fad10574b303a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1332/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a3d52359f63660c4d31595623bc56e9de01e0796 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1333/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ce8285c3964dd89305cc0fc2d7b87f2b08f325f8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1334/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d6d9412d4410fee86a4228156cc5092043792fe7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1335/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6e6be27fc24d4e8b048f196f6e9109b162a8dbb6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1336/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 731843a1227ba8be5ea64b336dd1dbeb5680fa3c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1337/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7c17d481acbf8c1943dfa9b8f97bd91b21128d51 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1338/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b1d31da8a2b82808e30d0064d09c3c04037251cf Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1339/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 57cc91f040c152f69f8c11d9ce5b8ec421bb2bec Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1340/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8cf4a0fedf73a14ba158ec841668a917399d2d32 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1341/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 18a6c826e3dbcffa5e65673ecd715682b3be404f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1342/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5fa887f8df3edd2b84f471f2941a24c77b48463f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1343/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3a279a7029567a2068639fab04cb37728892f37f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1344/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 47a81225ea4d57e7bd77e35805f2515603384cb6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1345/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a0e528691eab2a006b73b41c8987a9de0d2d8f15 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1346/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 26e9752ddbbfe47ae22dc90ce80b09a47506046c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1347/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e8b096b5aec4b4800aa19e4dd29c0084aa722590 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1348/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From bb828337f00615926f354fd3d505d14fd86a5f84 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1349/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5041fbbf3cb5a0dbfa0d77c4b84172ae7a22ff94 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1350/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From faec708514afe57e2514b7e0f30d1ebd1b1dd3c3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1351/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ca9052c7c29a7187d3f35fed2e4bd7fd82e89d67 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1352/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 508c44786c822b04a8af88c0959fadd0a79b49aa Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1353/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3933785b82559fa3843b8a86d208531197e7d6a6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1354/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 169e09ffdcd3004b39d4a13527a201a2e2756101 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1355/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0c64416848306bc0180baaa6ccf8720e3b7d49ea Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1356/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ac4febebd5ccba3c13f28a8b484c3d40a82b61cc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1357/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b4782de6f1828cd7671c7b2d79e840dc67181785 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1358/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 15f74e651b902a3e2244a366b051bfab046c4f29 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1359/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 53e101c80981485c0bb3db9627627f63299d7242 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1360/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d3b6041ed7c93ca82ae90a9059dc2fb0c0fc8bc8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1361/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From bbf0c69814268852c2c0fb09874d844a0af06920 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1362/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 16eac1bb4dbf650e33ebbd8d66450f4926065d39 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1363/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 768b523526a474da2c90ae7ddef2136326e88560 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1364/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 298555381df7a374cc171c1d7f474fbd0edc6af4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1365/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 945e3bd47e2049999435c7b71256f197335aa1e8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1366/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0cf1c4b9407d343f511fc171d4aecd67b3f77d60 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1367/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6d8ca040ee9690a8cdbd22775e2583e37f62c590 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1368/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b9efae505b730ef11dd54291bff9fa65a3e57cab Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1369/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 17e249c5b7bc1fae219ebf688d8210962ebe2e03 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1370/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 09a28eb79cafa1f771f0937707f2255f87b44154 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1371/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ab1c44022972fcedf14c7008728e81f216a1a342 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1372/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c99953e7447d7b50f35df4d4f0a9ae01462332f4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1373/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 11e9d52a8b016e49ce39d1cb629bc27c4f2b6e33 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1374/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 60006195dfd862c03bcd33fa212566b5643f3ee7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1375/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d3adc0a73562cdd297c9b9056d2a5f38c54aac42 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1376/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4adf8818019f2c66595c9a82f3bc1c356a5ff934 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1377/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4af4e82beb17ac9cfbe2af5f32bb0a3f04283d90 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1378/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b5667bfd58a06be855f41237405cd64c77659e6e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1379/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0c260ce4dde0f1ca7b3812579003a8575f3ebc65 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1380/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 205cb5b674b92a6f01f1f7d8e852e6969643329d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1381/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8d1f821a25b0c2f0a3f985ffbaaa70b2d0f789fc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1382/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 649f737be939bdde89a77564f4569fc2a1de2941 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1383/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2df6e3ad5d3e4aa6a612ba093e415ed7848e3f2e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1384/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a81fdfdf7b6d9bddbbf35219681e79e61df55f52 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1385/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e2026d03f418f570b20bb847187a835d49347ee0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1386/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 57b2123370d708215c4299d088b9ac4609875692 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1387/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 12021c0e4d714b5a2804e08d07445d84e0d77b10 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1388/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d596d136e0bae9e9939df18aa4e91557029adef7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1389/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ad3f97d5641f4a5b3c8da92fbafa66b109ceef3c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1390/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3be9c93538a8824728e807c5267223cd546ba395 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1391/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 211950e665ed3ea79d1dd95dca2ab18fd84f6b0c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1392/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2050a2c02efe0ab09b6bd10230d444c326c2ce31 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1393/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 37ec0b3aa6d7d68fafaf62f82a7d12f1489e34f9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1394/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0b35d8a495c8995ff493cb3420be720f1514d33d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1395/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 088225b25879a5f94dd493915912eb169c3f58f0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1396/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c203aa0e4ffd0233d76c98eeae22cc019ae1f867 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1397/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d0b6304e1b2e9158cc63239472ac47214b8d7825 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1398/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8b1243863f64236909c220794351bdc1f7cda025 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1399/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9ea1b85e557e5ac217a824221b3342aa3863f69f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1400/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ef725ca6b1a0a5c0a5e952feefeea551a81bcd14 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1401/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dc61aaff8cbdd2efc2d67cb285d6807a900c6ab5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1402/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cef52d7191da8af83735aa007111b993088a36ad Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1403/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 32fd9e508b97723a421a6bb6f9272a60bbb1e9b9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1404/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9ff3d225e03a6fe34401b8de074559256301d2ac Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1405/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a454876f2fdf9d9de125ea66d07451366d33139d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1406/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6ab5c40292ec5860b7f53b5e1f77de3c4b0ffd7f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1407/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 657908af0c13b58eb56ecf83bbe45b2ef0b938d7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1408/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f2b598b92afa8d6d1b6ea974057c78773a698008 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1409/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c6e9c838b6115f48292577c51790d4ba99842fc7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1410/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6a1f9a42e3de0b32950b22adb34ffd0f440b4497 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1411/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5d2bd990806a9c2a9dbc329ea9d6bae4cdac5342 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1412/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f24dffd132992c8a49cf15980bd200d2f526e676 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1413/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a5061b4012e327b0861d5094478259c57f04dd1b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1414/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0cd6138211222e78ba4246c63e342022fb6fc7f6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1415/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8ce09915a6a3b3b6ec57fdacb3b7139380ed72c0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1416/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f53bcbb37aefa5112c2d9826fed63f5caad56615 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1417/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 58a4c7896680a9953dd5401533a7e335e4db8579 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1418/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1d2ae95e7400bc06bf7789bb93849ade5093b3f1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1419/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 551afd93ac1d15ee434e4ba5483b7390470247b9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1420/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 64d41bfaf4b9eba609b6ebeb245c9e4b4e7f54a5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1421/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3ee9bd70ed09d22fe988baad5036cd09ea64e126 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1422/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dadd5f48debb2b0ee206a17df3f7957c5da99bd4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1423/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2ee5584aec59b5f764d0043a9da1e255bc55eb0d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1424/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a9e85d8a0aeb1943c0c5a3165406353f8a8428c9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1425/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fd4badb0e0426af3f83f3c681a456c1387548025 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1426/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d712fdecd7ef8e7b50ccd1347bb53e639cd363ae Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1427/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From aaa58b3535d51ceefb520e539c77ebeded48ba5e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1428/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From da655a962a3a194538481de9b5382a4a579e860c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1429/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 778a298a78e06b408053dd71b5261622df4c59bf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1430/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From eeb8b46417f204f5483e86f79456371ce11e4f72 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1431/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 009bc8763132e1f12b8ec4770281c78aa5d651fd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1432/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8948ab32e4024aff85f1b921d27c6bd5645637ca Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1433/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4f154b9827e5f4005487b127e13b54159dad5aa5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1434/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 45f8f6bc0e9d66ce14f1f858e48e9108ce967058 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1435/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 89e7a3ed8ffdf1802590c3b2af16c3a843f51c39 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1436/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3b0e8f3db7f1875f00401ddd71787ecf20f2fb37 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1437/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f212d6ff1c126f003511d6e0e7a83d6fc6993546 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1438/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 47e470c6591b1f92ceca7051c1b44fdf9b41e3f5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1439/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7e72ab33a889e072ccb43f3591d82a888f8df56b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1440/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2507628703c883f0eb7509f2fbefd735afe0d833 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1441/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0ac289d5617cd343bf31cdb0cff0fcba76e58a13 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1442/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 96539da9714a46a1a61b3c2f4058508a54a36c86 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1443/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 917bd17ecb9337f004ae3acec08e12502096d00c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1444/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8eadf20060a58705e6fa8d848762db6bc5aa088e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1445/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 93c4a8f3ca73b001858ee09276453d8cd1048fde Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1446/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 16063acfdfdc086dede9a07f15295aebf79ad14d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1447/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From da4dc884cf3cda6a106138e4b781a30db3a2c6d4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1448/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 66fce0e4d23bc052e08496fa7e9ebefa8ac7ee7d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1449/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 14b236f16e1f9f8d81eac9ae4c86caa2e0c71250 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1450/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 80dd2c0f0c13c74a4d72de7ec0eb0f706fe374e6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1451/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f352c35ee48f3c008dac17ac683dff21fde0450f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1452/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e9e1773cbd422680f7843c57246e3e73177d1232 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1453/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0e9f7fb4d23be335b08fa85dd012b4dc6b32e3d8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1454/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ca06bb6af737d06d732fd94ad5314df10573e906 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1455/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5da7a3eaa2f75a4b7a9a6df2f10715249953e464 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1456/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c73e15ec69dd24da28223fcde663bbfeecac9a1b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1457/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 206e58f55f1ff2aaba420f4dd49058e07f52b3b8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1458/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7f3008acf8bcb7af1e3df37c55e4e354074d2b65 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1459/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 97d1575bcd5296b64ba15f4eb7359b2ec29bdd79 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1460/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7153e64e8c1d1e9852fc1ebb4ac8356b7df57dbb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1461/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0d2ea42fc2236714dd750e7826ebf49a03572933 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1462/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9077f3529941617984a6035d060afd43027f6bb6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1463/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 625216e79491b38b885c6d2afc5f00a622dd6e15 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1464/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d6833c99d77610940524646fff566fa35cef45dd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1465/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6ca1be331844ed04f2466bab2ba5ece16625a491 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1466/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From db3f8a2f9ca2ff167f68625f818353f194707a11 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1467/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 060f807a3c0273b7b4f13192431cdf2b9b2eeede Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1468/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 763f8c3592a195b529b67c72141f5cc6ab6d192c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1469/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4cc33f5e04b2b9f518c955355be8e33ae1e9cf16 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1470/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 519acec00b56f463199f0c8c66f586c5e586e1b5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1471/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 66d0daaa417e4da128d057753adf791bd57a39b5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1472/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b9f3241af3efbd8f2b4bb23912a8367a9cece33a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1473/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1f06e0ffc1f4060f698b0ce4d4fe2fad6cec54f5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1474/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 19fc6e4fe9c5c78361f4ac2670130c864a9753c2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1475/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8cb47beebf0ab47e32c2a123ed5454ee2c5ccbed Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1476/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ac2f6f41974236199150d2d8e173bc3ee70da4e7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1477/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9cf47fdd56ebefed8ae29e62833e7cdf66c89474 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1478/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dede458a36be587a7b90d18e19ed3d476f0922bb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1479/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b483fc25650910852ec89a8d0b8dbea43dc1efec Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1480/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c070ba10469a99c0d18a2d62bb0547d01ffac02d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1481/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7e69e2f2932f4201a6a01aec14d99b82aac19537 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1482/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From befe2e8d4e9a9084a882fc7177ade905fa238c40 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1483/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 12184963967878271fc1c18e17cfbd52ccbe9ef2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1484/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a773d0f3f3c30d204b020b85eed527f69615fd12 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1485/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From bbd5b10dc201614f8624bf01115392aad9fabc07 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1486/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9d6dff20699f951b04def26648fc6cb84e4fef9a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1487/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6e66349c0bb77c6cdc1969061a16026284ad4d2b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1488/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 70cc2510c47b339cc4763e047f02f38b48cbec1f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1489/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8fc6c1878e35b84b0e3e7f97878d584e6f75c71c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1490/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b7b88d25c3a35e6efebb89d1a118af8d68621e73 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1491/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d67cff56dc284775f87ebd299315b0ec90b67c30 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1492/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2d8460472ef8a4c015261deaafc7d7878ac79a97 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1493/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From bf4fbf953903a2d739fde3b257626024600dbd1b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1494/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 867a65713d36e8f552c30f3992805197360a5d05 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1495/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 57ef71ed435d0855192e65bbb4759988bd6b7c7b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1496/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ab7eb0b3d8bc493a8d7ce5b0226b473c504f0b72 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1497/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7dac93b75f7756aee1169f937bdb7530a1b0382a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1498/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dc04f3e3dea516156c98f028029f5c18ef5ec933 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1499/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ac4d03bd81993e0ecfd7fa6f66c5147cb209d928 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1500/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b9cac4d082106312ad0c8ff10f9c33228e7ea8ea Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1501/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e6a8b54153abb84ae0dca55dbb30bf144dcda23b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1502/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4f94fe8bcbb42a3427c194bef88dc1c6f5bb8eed Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1503/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b81630b7b0df345e26cf52c4ce600bcd992c7ad8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1504/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3dc2fa59c34479c4b5ef365f0d30baffb3d531b3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1505/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d6ca05b8f759ca62130fa9ecbfae0560830092c0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1506/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 846abdc38a73a06af98debbc4768221b4c4ae217 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1507/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1d75e7fc5e26eabb8b0479e300df001252c1bf7d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1508/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dfec7d7817c704a7e57fb67536a60c88b4b7531c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1509/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d1841139b3db4009ffa8e9ef06a5f95bd20d25c9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1510/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 869e052afe75d0a04ed9a92b69b53062c40feb31 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1511/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4ed637ec7b2b1fc717c916fafb9dfb364008c9f2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1512/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 650699019ad7c56d43ee14ce3770d25bb215726d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1513/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7830f1b0484c2947c0f0dbe11bbb7c2c2dfbd343 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1514/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 142312d14a83e982918b918c1161952aa838106b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1515/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ec9ebc329b76f57c84043d5e803d3c4e68f48e25 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1516/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a9303e39e6b433bc846dfdd761549759cfff0c67 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1517/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From eb3157dd1bfa8689a115378eebef1ea3268207ac Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1518/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a176584f14cc9a0e8ca81a52c200c4e23888e3e0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1519/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4a2afa051a908f5152a1d4b7bf8903e0746abef6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1520/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4415074e3876313fd74bdcb77209a7134315d31b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1521/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 20868ebb3d0d1391ba523739b58f53554a6c2c31 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1522/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From afa80b3798e08f41a849e5e4fcf14720d5e4a434 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1523/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f6880f4e84914ee65958e14e2fc3ef5e110ab420 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1524/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2198b1f458fba5b658e38eec751fec1286737cd5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1525/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 92411434f444516abaefa784eaa4fe498ea2e51f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1526/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c8c624be2ab920a048c1d759f09082588e86b5fb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1527/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2f7a3da23a96b0d42a0e866d011ed78464ca13c0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1528/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 794084d698bf52592fcaa6bd13f114d78e22a59a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1529/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 17237cf3d6c7ceeeafae48a3251793b1e6545938 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1530/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f378dfaf2241b63bfa558cb1152b904319b1cc96 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1531/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a642afd45e4603a55f17d6048907faec52b05e02 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1532/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 474478957cd01227c795048f3feb0101e11966fb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1533/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c1ecd24f371cc268209283c6c785fc89686e21f0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1534/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3100b00a3ba3d14af9bf7bc1c7bf5da36389c88c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1535/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8c13f80eab3a2aa0f90dc323178064056f8fdd77 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1536/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fc2e7958ba95033ce754734d5574657d53365d9b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1537/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f0a026664bfc170fdf9f012867e7c674fba88588 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1538/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e20754ff18a5db44597672c8c50b88167e5f362c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1539/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d90b595a3371dca3f782fe0f74ba68b5e108ca60 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1540/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f99d96b05397a06a322506cc5cfd46ef6f0bd61c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1541/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8bfd83a8dd6149bb9df2e628fbbf1a31cec9a28d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1542/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4c7d83f3abf7b68966e25ed46b211ba08f64f762 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1543/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1417c1a65b910ca91018598ad03572a4511ff6f4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1544/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ffd101785fbc09a62ac23231aab44f44f24631af Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1545/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 369d3674cf8b31f17d2dddf3385ff9816f5fc700 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1546/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e6605776a2ab0373e4e3d0c0cad55bcce11e45e4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1547/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c7d83952d69c3a3e01186fc9518c17a1682e441b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1548/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9ec44679943a81332c9132be40bb587c2c25f850 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1549/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From bf8c755403251174fb08da85963639aad5c04444 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1550/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6c238b1c535820c41caa7d73fbb0905ea7f0d38a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1551/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From eaa9ebd5528c984eac2d09f3b05db0e3dad75815 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1552/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6aebb29068bff643a274a1b19ec71dafe73d0a61 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1553/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0e6e15fbab207ccda81064c934e9d7919b731c50 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1554/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e7fa5d6a6c3b4f6ed9926cb4ad07cb2bc0386dad Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1555/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1318f03a0b5cb5aef28faf401df7520b9bcdf6cf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1556/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 84ab230fbdf47985264fe1341007709cd325132e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1557/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fb0895d2d843d945982b0d06d3e46af06b9f7c22 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1558/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1f80e7d6888865615881720df6cb9e20c370fbb2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1559/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 74b0bc070013a579ac85bcf1ef5196b50cabbb40 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1560/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6b9f32730bdccea9348a68e4abed305ed299ab33 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1561/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b2ea92f7ab1026c5b079c2fe4ed0acf6db2970f7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1562/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7a7799bfd47eab5ccaade9a72ecd14bd4ad0f0fc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1563/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c40e3cd6cc29ac2dbae57fac70d04730ce54311c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1564/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 916b3aee22ce712eeec44f4137f7b7d3743f331d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1565/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 24c112f98da8ff58bf155fbaa5440093ded40850 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1566/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b40a1c9a34b2d3fecec9c38db84d4daa9702c7b1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1567/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 634dc80a1b3e0683c851a872034154a354ad3a86 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1568/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0f2ec8a3b9127e37de630b615aaead976ccb2517 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1569/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fec51ae1f8746e6a7001d31f3dc8dd7e7ab5b216 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1570/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a38df3af124178ada868c7a0fb10837db97cf263 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1571/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 190b1c227b223b55035f405e14505a4311cd8dac Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1572/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2abbe6b2dfb43336043384516e8b83aebf14f338 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1573/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 109e23fd1cd5f43e9ba9ba6e6e7c5aa77a8dfea0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1574/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f1be78d9bb372a97c419e702a169dbdef525f967 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1575/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From db3fcbf0b1f41a7ad785b81f38c6e5d5d70c917d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1576/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e50c0d9d9d0709451ecbe5b909fda2100431c5b7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1577/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1b2065b571f9762a687e0f7c3c7dfb3f7927806e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1578/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f06cb63608c53099dc94aa48462f1b5144df89a5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1579/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0d3ad4796b16cc59b0cf6335e5c7ecb9db7cd82d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1580/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3f037ccc21f39390f2bb1423b1c51c25f59f3987 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1581/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7828733a29407731d3adeeadd285544bd1c5b38a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1582/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4bd7633722109ba12cb16dc0ad22e6dde84051f3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1583/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 23510c304e04097f943a328d5544800f7c769273 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1584/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e304ce0f026e2cd6518b838e1e46c520eff9f021 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1585/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a20bd42ef1332c85b2bdfcb15e68c411c5a9dfe7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1586/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 673a13d18a07f9462c8d04e4a8f8d3962ec34355 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1587/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 714504b964f97d503f566f294e8d0a98fd0a4bde Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1588/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 43a1d7d5e22f668badb938686ff8d7871073e766 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1589/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b0af506e938d31828a17817eb3f8a7809ddbb6d9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1590/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c686dacbda164520ba604ce50543d9ce2da1b967 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1591/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 275e8aedfe1977715fe13cbab7724933f63e4fe4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1592/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 941d31d52b2945bce8695ba9cf11ab82eafe6baf Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1593/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3763c9f8296dbe81af5c8df0dcf04c22fa509ec4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1594/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 66ca9e43a1e701ebe810a3236b0b4b14bc5e88b5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1595/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 811660f93e433e8f3c1bbd0ac040023ba6608818 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1596/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cd5a2a96ed330a281f410f45ce68d23aa24b81a4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1597/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f7ff191f8ce1bc713fe9fb290e86062dbf20fcd4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1598/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e09c88bb0775606b0ea480a609dd8275a1685c29 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1599/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 04bf205f9d0ba2577cf464d22bff786b147b9c97 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1600/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 053aea799f2e65b3d3e19fd8445d0f1806871d9e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1601/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c39e5b03740f3f2c87a0bc41d684ca8fe9f35351 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1602/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 005c2a0d2a0c394533ddfb1c5a871cb8b995d7c9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1603/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 68e06ba5df1725f9482031f51ac40434d761c29f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1604/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5349ae541014c59f15a7f09fc50eb78c48e63fd9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1605/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1db388aed1545684cf7a7afee3d6d23621ebf68e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1606/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9f610b703fbdf5fb330ae7530cb73f8c30a37805 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1607/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 999b244e3793adfddf2b99a3b7dba3f20ec490db Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1608/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9fc21399b868572b81284c8c4c8223664272fd00 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1609/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2a2060f82507b81c78844398c428d3257400f0a0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1610/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f52500f1f763a10cd0d7d31eab1a7ba4754495d8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1611/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3c6d766e30046af07421d131e52a86f2b4271e4c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1612/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 99eca28dda4665f24b9e1314679d8b90de36d82c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1613/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7f79d8cb663c9186979ad4365045540ae78c21a1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1614/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a8b76a98966946adc745441d9a235cfcd6833e41 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1615/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f44421033b455ec6ed7c47516fac1289377e5b14 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1616/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c66483382b7ec9430ffafda205f802031720291c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1617/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1f035e50369bd3c794df92f824845d553bf20e39 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1618/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1429ccc30281ccacb8b68299c821cffe409d842c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1619/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f38023c462c9b71007d0d3b96e845087ce595e5b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1620/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d6cb3b285e65764cfd2d81cd9414f23fa08685a2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1621/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f498866c46de185bfcef659e4f2a415c8c1cd221 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1622/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d8a7f80c2a256e57c1716be0043537053722f8fd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1623/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 68897bd6ac3713dae70b0ee8b6f6f1da619ecf0c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1624/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b2c265a7d25541b32a44fd56ff46dbf273315338 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1625/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3158d7ab714154b16cb2a5c205e2b57a5be4b77f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1626/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 37d30498f9a283bde63b83d053db55f9ccb412a6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1627/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dfde72d1d5e6251728fd123b7b139a504a6654ce Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1628/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e6e4785a884ac7dfc1099d23897200be6098d2c5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1629/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9976d02858b270e693358ff40aed91a091323e5c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1630/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 609576cb41fb35667634c83b22e1cee2d51ab196 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1631/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b41976f6791381edd885cc91bdaa5982c5f4ca24 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1632/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8967fec071d22abd962db18ef7d8545d31b59ba1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1633/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a5ea80ce5572f93a5303cadc05e4ed93265fafd2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1634/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2f5a2ad9835ccf21519298868443fa59cbc7d3e5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1635/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6864d73d163c8ea3be49bcb913a2c9e63677d5ed Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1636/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 26d3ba6caae6505e33fd4d1686d95a8fa56e9ca4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1637/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6c3acc50553938dfbf250820eec8deca2bbfd850 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1638/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8a61e86bdd5233249233530203b9695c8d86480e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1639/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c4f8083e4d4a253fcdd9a8e7d712aca8cd163981 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1640/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c1dd961e9cd8b7c208f5de2413ea6e4bb8fdcc9a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1641/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1dfb74c11c245929e153424747e83022027619d1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1642/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c593b3e4a06c6198fbaccff06187db519a4a9f7e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1643/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c77b18490335bfe8e83465b2a746cff30258cbd0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1644/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From accf111727d5e601e4be1ccba858489590312ab7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1645/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7944c804c38ec71055b0680f9606c6209b9678c3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1646/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b58b46b5bbbb55e52bcee3c7d298951d9b262b71 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1647/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6c4584894e713ce8a6497fedfb9348edd51b42b2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1648/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4415306d914898081f91de0460654c346c1eeced Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1649/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c44fb42336b336e7f840deae997ba84d9f329b71 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1650/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a53276236e830d816970caca395e75add05a2d72 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1651/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ecd540310215f8d68023660a7988f27a3f0b83ae Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1652/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2f1f5faf510652ec25e4fa899248917afd4bc324 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1653/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ee30b5f8ed0424dcccb5d82feb0df80bade7a1af Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1654/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8fc87193e809b6c07b17c52dd0e6b7cd261235e8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1655/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1defaea056dce2e9d0aec5428b8e55089daaaacf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1656/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 45895b51e932cf3059628eec2170ba65badad3e5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1657/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3d760af0668ae394f949001f86719000871ead98 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1658/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a44a834ea57753ac0e98c4b286b25d052957b46f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1659/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 56349124bcfccca3e59ca500962f1c2f057a3c0e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1660/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e76eafd899d476590b534ab7e1b4e2aac6adb46a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1661/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9281701c7441be2d65c01057a25d2f86dff083b1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1662/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 482bd334e4c4ce86114df5590801154f0541b3d9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1663/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b0cc348e0b68cbb2a1320280421079cbddf109c4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1664/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e64e273f846f68b06d4b459e01f9bdb63a1d5327 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1665/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ddc906c428e1c936ebe26fd03e08b4ffb0870240 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1666/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 17c05bc9947452f3c3bc393e2139b64092fb5935 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1667/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 008d37d614497ad4d4fce7ef7b6cded4e7cfd0e8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1668/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3d61fbb9831b518499e1a85a38d9247992a2d2a2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1669/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5dfa450949f7f5b6053dfd9635c01c823c93c0ee Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1670/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From daba69aa8edeb7727eadfb8a71c23026431556a3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1671/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From afd5c46885748219677d300ea2db73d0e35dc558 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1672/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 155d8908d363a773163fe952b6b925adc2caec11 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1673/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0c84435128e9c355a44311c26a0f498ca1941128 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1674/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b079810db4db97f91c02c439dc87d5c071176e9f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1675/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6adc59a150d3e14cfdbcdcef857b9c546508a90e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1676/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 731d031ba12b00c4d38ef468fcf3851621d59d91 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1677/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 45ab02b2016c903d68c1dd0f4ab1fd288877acaf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1678/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4bf7a557c6a78209c72e5721aa31c50c9fd8f468 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1679/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 42ac613305bff6d663139cfa693c31c33f9f46ed Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1680/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6146ad1177980f68ee82fa3982d6d5bebe8dae07 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1681/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fb01bf71faaa41de4c63d8a36e7ff7d2561a0376 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1682/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c3a34bdeb57c07e473f44604d5205f1e0bf3af3c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1683/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7395b7e14da74350d0c4fdf0875db3f2287d31e9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1684/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From daab0369478763fc27c4f7ec0b9c7363294c2be2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1685/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7d70fd131228f0ba11c99e50a6787f4438709fc5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1686/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 61451cbdaff6466e72178ff208cd70b31e3cdd19 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1687/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8d3d6ae84005011cb252765e0b91a4956eb9460a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1688/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4455ee986eccb318fff10c5c52293fb4db2ef850 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1689/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ad44cea238362e42cbf7fc20ad16afe9f013267d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1690/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ba1e2312df5f6eac4bdaa2b179759c7efa9f7573 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1691/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c3cc9b3f6ca7f7b240e27f1e832a6c28be9e19dd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1692/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6717a462adee82fc3bab8b1de8eafdbbf4b9c332 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1693/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a0a3cfe741c558ba70616b185eceb85cdf170362 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1694/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ba7295969b4b59e561d085279a75e754a2f054e2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1695/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 610169a46a003c87000dfea48118c2c5d5e5f9f8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1696/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 873ec097775832c7618f5ef6c3f5543f35713bf2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1697/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fa656329c563e42ed02ca9b062e8e3058a768be9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1698/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 451a0240b591ce83b4383bc19cabc63d1cf5d11d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1699/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3d17f49fb459f333cbd8a6cf65aee1f626dafb48 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1700/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3ffce44a2f2f0eaf7d4aff359707156eccecbe84 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1701/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dd9c2fecbfeee30572d868bc7b011edcdaecfc03 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1702/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5e7867d7e63f83d9999c7937cd36ad0166bd7aaf Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1703/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ab6fd903d4ddf35eeb5c9e3a9a54c5cc5cab1534 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1704/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8d253d47925df14a41c624f884abff673065926e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1705/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From be4d5ff325ecc1aa13db4d99785a03335e2f961f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1706/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7c9622bc1249b7b5fdcaf25f96f61928ea00f761 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1707/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 47dc0000981f128733c9b4702ba68610f64eb615 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1708/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 62fdd087200356896d829cc714555e3ca7c381bd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1709/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 757e11ff99863b44d643422c2e74b766bee098c5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1710/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ccd42e61dc987567e224a7a50fcd65d905697268 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1711/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0bb9398acf36af5003f298824220190cabd9af1b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1712/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0d13e5ed72941082a3659763caa1052aabf2339c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1713/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1285a1434c4758ed77f325f304853400a25fdeb7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1714/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 194a9286c362d02d7fda6da2199c7ed9afddd502 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1715/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d512f3c5ee079770f71480eb01384ca6de6ad9f3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1716/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dd270fb54e3167f854ba570308db846af92dad06 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1717/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 54f1879c09e57b2b12475e73cb8b962c4a457efd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1718/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 771d64867e41c77edd791b8018227c3a1c0bb51b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1719/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 96a1a1544eb54264af6a177639f66976e6075ce3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1720/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e0ff964c999d7ffe93da5c13a3813b1fba0d81f1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1721/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b0c457a7d0744f65c54fa153769a50d73cd7bfe8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1722/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 327ef5ca101cdefd189c5d7f22161c77e7a69247 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1723/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8abc079a720276dbd0864614a3ad1ec5f456833d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1724/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dae660783d819476320a60093c2c568c5e8d4536 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1725/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d32ea590f38c9cd5d65b495f3d42390caaa2fa65 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1726/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 36d42d9935a3d149bec0aadb536e89cfa934dcd8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1727/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 876cb20cfde31de273dc9d755fd0f132ea362cfd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1728/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0003301d3707809a598a126cbec9a55d9222b995 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1729/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d243877a7d15db6eb674ac4e3ede7e5b5a964a72 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1730/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2a6e47b611cbd92ca4f0a6de8bae2b0584f9d013 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1731/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6b67f38151bf4d988cb29164f657f1e562d83775 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1732/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 577a6908bcceab475a790a0f589755cf6d404d7b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1733/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a9fac6d3ef37c04d426778152eb2640268e6c0d2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1734/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dc1216be326fb2099f0eeee0f1434299dba46cad Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1735/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7625d1400b089cefaecadc09e91bf677c7d9fb78 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1736/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fe98902cdd173be93d7302083b83126963623c10 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1737/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d043b28358bd245933eb551eb8defdd1878179ba Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1738/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d00636221f4b256ffbbce07126145801572a386f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1739/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dc26945e98a4449c0dd86f8293c85f2690f80caa Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1740/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4b9acdb05c9496e66042a02a11a482b31e774736 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1741/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a46b3ec11150f83460c31327ba4de2863011ac1d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1742/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5211988a6c2fb229e4866f6481381dea04705691 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1743/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 95a0249a1f7fad7969f8c3e55790d6e276a72cae Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1744/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5b19feba7936c34cb494b95e77ab22474208c975 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1745/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9db2082818a74efe825e0d63bb883c1dbd959c69 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1746/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 67d9c8e3276cb70f55ba594590d2cf14a94ff13e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1747/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 54130f6ed2a5f92700583748c6d6c21c0f0ed250 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1748/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5c178411c43459a8746b2077546ab72bce995a1b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1749/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a9d77e0e2dcc8b333b443083d512b0f29fbc42f0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1750/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 792ee7eaf20e0bf3fb569d45565056a953fa0c6f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1751/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 086a7f35412349c9e3c31197205469dfa513c2df Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1752/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 360725ea5267594d8861bdf1ad3ed0f7b24c3ab3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1753/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2ccd13736a681333871e422efb5fe7462b498dbc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1754/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From af0e304804a1568d313075452e27c1ef1021c0a0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1755/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0e4b1a33c3513d645963db761165858b0abb7605 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1756/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ad65a04a9bd49e3c8f2767081bea5d08c039d628 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1757/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c0e7046746f8600bd079d746ff275cd9acd27b27 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1758/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 01877d42f14da080b93174b1c856bd521789571c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1759/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 45e3178e56d2bc23585479c2a8ce9627b0961a1b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1760/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3b01634e0c8564b66a2b13dc7f6af765c1cb6673 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1761/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5b3e6450db4505d911fe00177a3e558b4bc99e83 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1762/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1afbb7ab9c53443f4eeacfd22f2f437bd6e8d2ca Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1763/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 45242a08fea9c08fecc8def9ffcf74042e9c73ae Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1764/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 19c04a30a31b1f8621e3b94f20be6b26053f6b33 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1765/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 772c64b85ee640f3a869b863a63f2916d6cd382f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1766/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 009bfde0e7d9b95cb55ae489fe6293af7df01b18 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1767/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d439ba7400dd9c9806d65e5aa9487cf247320361 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1768/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 825cd46addfe45fb2c5de81c3e2addf1bd339a67 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1769/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c5cec91a64c50fb8e1beb087d01c616ea17c78bc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1770/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c9ec0e1d7b973d128dda94ab7ac89f62f519b4db Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1771/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d860652b31d82da72ce697a2de7755a2e5c82dd5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1772/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5cee422a7cebef09d4ea3cbc071df57199dd0245 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1773/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4e9f31076ef4c414b73412d3f6d8b6a112b8e865 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1774/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9fafe6025a9a63d08877fa15eecb529c03c4ae28 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1775/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c4a63aec893f3faa8ee1b9d72c608c976f85bdd7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1776/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8f12c2956ceb768c96839e316bf5cea320dd6676 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1777/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 08e465bb06df988014516d1cf63cac964525fbd9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1778/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8af46ca059c7754e618ce9d7f8c8a2cd65a8e594 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1779/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5fda15d4fd196ab12095bd6bf5ccb54e304af768 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1780/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 841f9e6dcc0b37a35abb4e2b7fc9a774895fb5fb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1781/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5d682f254a02d26d5f8a5113102e1acb32cfa2e8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1782/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5e90e94d308a929e493859cb7e070c3ed7361066 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1783/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9342b54e4981b308eada9e17f0ed8a457b72a281 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1784/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 68f98a7432eef058bfb29eaa15353425a392f4f1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1785/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 38754df6c5bbb4ba8c2b8e35b8fd0d773b284070 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1786/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5495fdd90d805b9e256d563bc30e604e6c062720 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1787/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1bf38cfb2ab5df8251a7a5ab7f227896ccff1887 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1788/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8718cf3b2ba68f21c5a4bc285cb78c4173777204 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1789/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 41dc1aafcdc951cb1e5b306399cddfff01392bc9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1790/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 363f356f2a2ad65d47fd35bbab55a35c1da5f75b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1791/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b7a785180cc46a2022f3c78d93af60301276c1ae Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1792/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 683fa81ab940169087aaef030354cac2f2539cc6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1793/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c4ba7f290186e30a2442810183716460100a915d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1794/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 82487f31ca690eacc263f50b412d1bd1cd1c9fcc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1795/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a2d711dcafda3ce0d739cb090d2b6dfcfe610208 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1796/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e8b5d12ecc3b281b5c66ca5786b7c96c94ed5e29 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1797/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ea7ba9d7b9b4b1ed16911871ac5431d17f74a869 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1798/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 812740b1ffd62675af32a34851eb370db7f7b5e3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1799/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2c3c192b563e6f71df30095d749d74218bdeffe4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1800/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 76af823ba15f0600ea29cd1b499b25b8d17d8986 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1801/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a1bd85fbea5b4cf04aaca0624479309485c6a783 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1802/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dd35250b88f29c857f38fce0b918d948481b38b1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1803/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dbd3a57b0a6d7a6be0abc94c33c2d17faa86a592 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1804/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9b17bdac61d737fe662c250d4ca52571a9687865 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1805/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c559f11155aa740da43ad5378e28c361df976769 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1806/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3952c8e28e8c81756ab003585e58bfd7f3465488 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1807/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f1c8ffb3c3175043f4242ba99b47eb0414fe75e0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1808/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5eb776db28a4cbc063cac181685f51c8c610e042 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1809/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 779de5adb382dfd1c645e58f6ff3399abb409053 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1810/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2a516fc2a8e9e028a7e3c589e1091bfb0b04089a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1811/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 121f98be060c26df37ef9b41350fabe3a3abf690 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1812/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 663867c48cbbb32578c39af23b780dc7d27e13ae Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1813/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From bb76f47236330a26395d876368604ba2dac08cb7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1814/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4c0657dc01b0d25197db65f742588667267aab2c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1815/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ac3e1a74c0d061b72174d96bcfa64f3569f7207a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1816/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 398a2d20bf96d5db1175b1f00c0cef9c3e80ad30 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1817/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4dc48ce712ab34e4cb9da20bbc22a8ab087cc19b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1818/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7d155e2971a95d8aa88ad0ce0438f4606f5a601f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1819/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 95e9c5b92e6dff337565f732a606ba4caf2f6cc1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1820/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ab48fe7c01c6d0c6825c810444b59c87abeb1308 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1821/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d58b23a14462a78faddd9588e05c23955f10bdc7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1822/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0454b7de2a5fc9ed02974a54807825ab81647dd3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1823/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7e43379a9ea820618538a9cfcf340491851c3802 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1824/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8daa770312df76badb24ecf915a6fb35cfff090c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1825/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8d0e13d2b8bef9d3546a6f5195d1fca24fa3f678 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1826/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fa144deb0043b21446f1f155b31f8b4aa11ff291 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1827/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d5353275b9c9cffa644f79e3046faeeaf9aab5e8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1828/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 666cc7df378fb4226eacd4cae06183fa9b829c1b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1829/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5b9c4718cc8810b6ca510094388421578e3c5c50 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1830/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6c8545d26bc435e123ef131cd4d85243531b815a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1831/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a46a966638fc0e9ccfdf42f322d00400946f4bff Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1832/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 490d51ce0a51c43737372d9f78f128257aeedf87 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1833/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 315524e2b144b73364dc2dbd827e2ee66c002bdf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1834/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a3b513db045e1e1f8854ce2eefd37bd0249168a1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1835/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6e9943b6b4202865f946a046d732cc8f72d09274 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1836/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ef6152c3d2f644f7d710536879b2495e504fb18f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1837/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 484a31c0e4e869a9d54ff197e7015d4ec5d6fc51 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1838/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e0a8e540cc83967e1680a64b0c300af2ccd99db9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1839/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e68ba63a2c5c9ae5187ee473d04ee605fa137332 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1840/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3f6a020b3b84ab504d556a843d23b1f4bfa2aaeb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1841/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 979e7589ae741aedb56be6a28c53879c16ea9eee Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1842/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f4a962969eb647b052e419d48d3fbaa8e55adf94 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1843/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1f8b98c573c81cfee8a1feb59d753150349e7b4e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1844/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 76018907c90243a18c72bb654c6abe055e55b407 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1845/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fc8516c855bd7b3bc5c7fbda98466e5c55a6839f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1846/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7414f12d585a4ef4be12f416bb518fe0a6968a9c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1847/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a3afedddc6713e75695dda8f61d0caaa8c72ea1a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1848/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2119b93297f132d97eeefad4e7e8b265d2fab4cd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1849/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ec9f36aadec05c3ae84d2c7c097c2f8225d7e71a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1850/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8985ed21a42f7e818c6548b478c6ebe813f6b517 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1851/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4d6ae91dc5c927ccc0aed8ff93c88f2b9179a46d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1852/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d1c5ac9ca2fe835b2e9b502037ce62dc82233817 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1853/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9ba403abae211e673b59a2f75efddece041dd4a9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1854/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dde4356ccdec765d1a46ccecb5078b412cfe44d9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1855/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1bb738d28ca9be5db88faf4c855e24c3ee1a5550 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1856/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8bf822579c553cb14cd4895d0ee6dd54d59eb532 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1857/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 76bdec7d449df11756c27f8b07fb68fa6f4fb78f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1858/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b58cb5077bc1bcc4e10a27743c19b0691073ac33 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1859/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7189d0fdb6c6aae8e5146fe6405fa7900429bd6b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1860/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 28a0f1f7b2ff2dea3a071203f41d5e4ba0d75a13 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1861/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0e6c601362089c56b4ac56668262899bab5c4481 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1862/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 869bc6ac70ecc813ddacdd4fe6958c1fab06cb12 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1863/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 185a09463d201b9565e5560f252af1086741f0c5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1864/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8082c47caa99f62ad4a45363757930846ec8dc87 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1865/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 17cb0b3f97efefe3bd2e5e803f729bdc8e3116bd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1866/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7dee8fec05833fbaa5c4924ad17a5c9402bc20c0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1867/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8a311c93ca15c120fb65b11c137a202429063c0c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1868/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 016b4a5ab60e58781ee557f2e6297f621c65a725 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1869/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 79bca9c144498640ea0427e9371bcbdacd9d0ce3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1870/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From daa48c10064d6702b6c60c8b3707e597773a6135 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1871/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ee3c4d6cbc064d054177885e33e791b892f5db92 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1872/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2fc836ea729cc9b91576b30ac482ae4c50d4ea04 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1873/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 001c631dcd93afd794060d0d7a6cb357993f35db Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1874/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d14f7f4b30ca8448de0149b4fea41d0c1702abc5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1875/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8eaf2c02b49e3f3133a001eb0020281fa26ba419 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1876/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e322baef7727fd00822633f25d0c265dea88fd8a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1877/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 63f497ecd1f136f3a5fa2388581b9fbdccd32f92 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1878/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From eec61626cb105684d3e22d014910cfee97ac9399 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1879/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 197607f517861cc4ec8897d7d5887ca800140d77 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1880/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c5dd00c6af6cb40376b16223d7a33f8e6a9c83a7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1881/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 77c32208a4da11a5243f69d01e148b494e9fee70 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1882/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ed2dadd69c59c7220a7c593dfd58023e3f9dc141 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1883/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 62111a17a9bf8887070823be7b8b8dba1ab73908 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1884/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d702f85e930a1df8ba81073a7dd54eccd46cf5d8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1885/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 28f78fef5476e806559d24026218cdb58344a589 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1886/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6a5ac08ce92921ad81d02707e7adccd66b8e3537 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1887/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 279965cd2adf6f80248a16647c876cc370feea98 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1888/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 47f5f6900e009b632c66a2aa3c31a6751fccdd5d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1889/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 792ad1940b6ca2b180c9c45e17e4ae18c9654e58 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1890/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b56fbc0222b46adc2bd4ace65351d410cb4676e2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1891/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 48779022a7b01390ee83ca84779486de126b364c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1892/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 00ab85ed073bdaa0c5b1dd5220bd4e48504c3bc8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1893/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5db2ac9cd162e70db46cd3cab47fead3a9fea189 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1894/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a16e12923e8ba09bae6d4183b314d20a7b3225cb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1895/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cfda40d861fd09754d968d4f90e43acf94921789 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1896/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d4216825d6c9ed2c6afd8ffc3ae8234128400297 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1897/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 23f2d94951efbc0f197b3a278268cedc4536c8a5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1898/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2c8071a3fd57d7a745c37a261635150986604306 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1899/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 49349bcd187fcc07e308f688f8355ba77d9b98b8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1900/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cc5be6e40ecde290424e394a8462577ba18bbfc4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1901/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5adaa7b3520be9a417dc3f76e94d06c9d2e700d1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1902/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 53b5d02570c9294be0430470f67ef8eb0b8d2026 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1903/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8e42ddf450c2668c7f83c13761af29fbd8be45be Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1904/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 892deb6f83ffafe959530a637ab790ba431d72aa Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1905/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 59e80d9ea95643fb9003ca4467f83d551bd9bcdb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1906/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fbaf02d972957007948902d1551768e6635160cd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1907/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 566c46b654bf15b9553c7bb1ebf39e70accc3e8d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1908/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 15b59499e908ee697d3f6bc9d16f1a0c801bdd3c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1909/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c9ac90bea212848261f31fb7d1813624f6d506c2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1910/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c65987f29c52a965dd8e36daf21999fe0cdb38f5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1911/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1809e2c4088d61d034d7d0d8860c72a0f3a5999c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1912/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 64ce67ff9ae99117f8f64c499de573ff4dd3c06b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1913/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 97a49c5cc47ab28c403cbe5828d592fdc0f57cc7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1914/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8c30b22adccd3bc9301328357927de458d0b49fe Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1915/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2cf6ea80aa009e6e142b1c3aa72be7d9969aab09 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1916/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2d133c578071718bb5c9982f22aaad2d5fae01c7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1917/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 649ecf0475ea0a0834e23e6a2420da2d363f40a7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1918/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2316cc137e04167e59c336ee704f3fb2d103239a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1919/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f510602de2880cb3ab02e08db937daebffb3611c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1920/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e73a2db860869144e2a37379fcc414d084e3be61 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1921/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6b2c8137d4125f3e12658e30ed396ceebaedbf4e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1922/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8a3ed2c207e5ab121ef6628b098f3779da91072b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1923/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ea9816d1785d0ed55e01b8f7cb70443079c96816 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1924/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6b419185c63ab802203ba7c0254ac34e75b90568 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1925/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3278cff849aab48c73014daeec039baa3a920c5e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1926/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8fd499b7adf26f138bf53edefb859cc35c453f00 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1927/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9d8b68a215d3c6a23133d8e2201176fd72c0f2f0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1928/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7b6c31963ea753eafc067cb8239b405854f3da25 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1929/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From eca37ba2fd8f0435099c3022ae190118d02ea90b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1930/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 74b3a9f441996d86d78ac938ee8d35f3a305f592 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1931/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From bb72539f17e1994ae41cafbe8180f43af7a65cb4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1932/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fea8c1774bd6ae2f7ba6af5efd76beddfe71dd5a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1933/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9a75115a63946e716663b3c3c58bc9a9b38bc045 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1934/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 33f3cd8c65b89a9909f4f23c1e074d0aaf6e948d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1935/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4350a8c2699a8af11a1dbefd7027ad5cdb957683 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1936/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2a05bf9a4aeabfe5eea9983a2f7e6ed0758418cd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1937/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 182561a1520dcd5460d6b59e64e0362547393694 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1938/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c0bec6599002e7206a06f6ea9007025d1640e768 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1939/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f5ee4209162ab6b55b79ee8505f6d1340c412604 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1940/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7a39376a6e851fc7b12fc2c3ba42a8947b9ae07b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1941/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 18279a028a1aa809eeafc7746a5f096b18f285eb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1942/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 93debb929d28c88a9314f06a372aa303b2ee1ebc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1943/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a1f508d2f38b1f78dc96eacd4743a7d8e1ab8bc2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1944/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 83e0170b043bc0fd90197a99280a0c6e9beb0d10 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1945/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 542c50293e80a543151436ba8457a97e4c06d11a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1946/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 22baa4efb298bd86feb1abc7307a445446d78b4c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1947/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e3b75c7519aa1fe3f91d4244078e517a0a1361f0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1948/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 172e77f2aa349b0c6a3fd4383a8256ca19f523f8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1949/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b6cf40d088e640a1724c6abcb4450d7f153deef8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1950/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8021c2d10fa79929b018bf8fd16b821604057ae1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1951/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d76a2c3310665dadcadcd72e38fe6e7cec3983a3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1952/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 389fbfb630c2d50b5f1cdcd402d65662536432f6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1953/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 607b9d409e4d97b8e0799aa381ca0ad80f2f18af Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1954/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 02483b54df9711fc6beae644d68803dada7eac15 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1955/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d484ceb37a3c6995bf0bb2287cf26f2c672022ad Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1956/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 35eaa3f2003ace42d780de187c2856fba5cfb833 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1957/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 025fa6338756455c2aec6208423c253e5d7bcfd5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1958/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 133c61f4745b7f4c2a6b18dad13ff9071b4d5863 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1959/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ef5d872e0016e666ee2c9ce48eeb91f77be57187 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1960/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e3af30e2f7f6014b5d90dadcf71f0066a2465de1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1961/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 805c8677eb6a2e1ecdeb40605aa7326d573ff668 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1962/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dd8b7fca974b9c4607dbb9076bc1cbc3561c5e56 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1963/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6aa619f44c675666181f5131e03db7e87714f4db Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1964/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fad7b4f60fbef733999748c247d94472412347c9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1965/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0998c68e06aaaabe2399bd5a1b07e562602bd0e5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1966/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2d915f9af6679c4a4f8229dfe648595cfd27ef54 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1967/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 49471937ba2b1fd7f3a5ff4541a65add1d4539c0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1968/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 16a3597fca2c8507df887f77f8ae7f4e98ce9433 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1969/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2f561f671188cc63f3e09f6f6ef6e19e9db152fa Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1970/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6f520729691e779d029651c7cd8e34992913ef73 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1971/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 45ca5f6858f8dd1014049b43ae8fe555bf7ad049 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1972/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2ed6d82bdde1a86030fca93554311909e1cf399f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1973/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6742cf6c23e46fd70ced1005a3452f794ae98e4a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1974/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 790d716d157daa48603947b69732c447dde7bfb3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1975/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 21dee5a92d1542e99b07b7c620399333366f4e1d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1976/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 81f19901c35c38163eb8d6e455d4bdbaf5cc371f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1977/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 133a6a40020d870da18db4738db888f759b3db11 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1978/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1e6629062364949e505363fc59ef3fef78f4597f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1979/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a9f6e52db417b82d5d0e2c4bc8757d39b9d0014b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1980/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d138151475b3c4e8a18e831381f45e772ffdc6ee Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1981/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 559e19e34edf3128f4c5c245bea7a82f4e2cbdc0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1982/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7a198fda130c5eaf14c981830c021b6e3e4ce2e3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1983/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3c1f1ff8848ab096c3bdae42446a70b89c2c09a6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1984/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 54099ba5973caa36c318460d10b591f8aa06faaa Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1985/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 82ab0e99f00ac1cfe859cb5adcb9973b743487be Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1986/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 338f01d9cbca6fd326c6e6c5efe705b8f4f34718 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1987/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 40c3c1ca0453e504c8f8b648f952727b372f4c1f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1988/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1bc2fe5ea359226b2377d4ece2c1651b545b04f0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1989/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9cfb3e85bfe483881d4468926d5f2f443f017d81 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1990/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f157a2482cabf0d512ec85f0298d5afb5c9f9025 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1991/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 131e4db88a148927310325e432dac86616a68a35 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1992/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3dd5ce1d90ddce59d36d9d9dabde98230bbc9519 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1993/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 771638268cc20b6c26c51a77294a144b01e604a2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1994/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fe2e2776472f853fba400390f4dd8ca2ca613dcc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1995/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 12a088b6e3f8b98aa348539858c774a279cf85e0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1996/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 669c67b9e2ee3fad168466e0ac20db71bc0fffb8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1997/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 35b60d1e0f5ed0ae7b64482a8beacdbe937cdbc6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1998/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 74358b368c7042e03c37129fed3cebece353a816 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1999/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7f12fac7c18b18018c66795f98f3e75ad2ddf536 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2000/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 76d1441d89c1ae5fe91c7db61e5d070271687b61 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2001/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 26bf4ee43e673d88842bf7783c9fc134e9025823 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2002/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7d9ae185b8cc36118f7c7104b584b2798a1bcf04 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2003/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3852b12b03476eda2e39ed51a9e9791bea52f692 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2004/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ea1bfd60434f48a40f4cd13e75ddfc37a03430c8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2005/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b26f6ffd55e3c42a7353102e5705b9bcaa3b09d7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2006/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 53e844a647140f56a23edb4504a1f7b40da42e37 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2007/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8196db3bffdbc60abc3d2874645c4a359d23bafe Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2008/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 78fc502ed72fb7c87ddf8de0c28a0e6a0a36bfc3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2009/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 82a71661da7483a4e0b6b9ac17f31de1f3b4be3e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2010/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 84ece968ab274163a3e2c622a4008fb576c4fc88 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2011/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e0e020f6750799a1f30fc558f0ccb885791bc317 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2012/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6b922f70ef6cc69e1a4dbdedf6c80281c23506b3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2013/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 981064aa3ea69a77cfcad2858fb0e69067ec5edd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2014/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1ffdaf2b6e99a2a64b5c61cd98804874205489dd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2015/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3fcba3543b79db54eb0fd22185f41b195e9fc8db Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2016/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 28c97872d2be496ff20fe17f07931f463f463ce6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2017/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4d4faaf1dd6ad7dbf1383bc333aa701ff00f409a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2018/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From eea4ecf478ad52ca462a48dac462edb9e5300e9c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2019/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 201acccf68261ac32b75670209dcb77b1411f9cf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2020/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 191ecf2e4ade39845ab96f468c7243850c4f6ce8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2021/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1ce648e29e4c73fb7566393bdc91e7a1c23819b0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2022/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 03b2284aa507d2c5003d14435317ed730e3dd32b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2023/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d633f4be977300a101765e798303b5c530a52411 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2024/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 39c30e80656e064981c57f65d7b6dc64168ebd46 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2025/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 67337fac4cc24d377f76aa12fff2506ff84d44c6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2026/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 578433dba1a3033067675b5f5e1d8f0859d1673b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2027/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b56d66c8b87a6f1534d74ea3bb5e3df639b28bc0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2028/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b27f1ce0aeacc78b86823ab54e98c7e264ad2e92 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2029/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 931a22971de622515d464e0987a51a6588091bc4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2030/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 391bc55a1058dda43191138089f0a5e200a2002b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2031/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a7e577d250f9c71ddc0b09e9affaf3502f60ecd2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2032/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5d52486ca421bc03f30e14b3dd49ece38feb7455 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2033/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4a0d66eff7b7221b1c43295d343680fe1bb31852 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2034/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 19ec92a050fa43aad87acc1deae1bb7e8d2138fe Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2035/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b763d824dd4e287fca79aaf3bdbeb399023c6412 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2036/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 720a67d146a0bfe166c1a572d1c10b944919faa7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2037/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ce4719fa13b68f77f9dc83798fcf1957a5d4e5e6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2038/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0c3cc9c171d4d36e6bfd1528d7d5d9deff459a89 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2039/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8f24edf51405ad077f1f7877317c97b4ada96e1b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2040/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ce6aab84e338de13bff150ab57fcbced9db83d91 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2041/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 865169ade947d95c443d2dac339b4620e3148d10 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2042/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ce2a0a92f7a0786ddc6ff522e697b74bcd283d30 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2043/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 18ee04deedf7ae77859b84a2e2c86adbf4603403 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2044/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2426b4ce0541bd75edab76352d0cb660c6881ca9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2045/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3a65208af04ebb6107041488f3baef63b041f7d1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2046/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b22cc74c94e3d93e7f7cada1931bca4ea299b744 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2047/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 61ac21c73149156f9f1d317bd5f7b5549ef8a4e3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2048/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 193955f23dfab894963af1ce1531353d0558dcdd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2049/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c3c42cfbfa04e3665ed2f277f57016333438128a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2050/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 41234b4d9eb4fcdd35978e8601afdb63b1fba537 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2051/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f2488105f4c64ca4c3591af7685f16b611448b23 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2052/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 02a9cc8398e5a936791d09555811317c0037ef80 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2053/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 752b746bd8d4d1b41c6fda4da7042a8265146f08 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2054/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e4f671daaaa8dd9e8e66ceab1e02245fb4e8058f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2055/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e36554cceaae129b305a480aed97d9d21e5f3371 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2056/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From df39a6a57152535a7ce1dc49a93d905ff31fcf8e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2057/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7e3231ba8bb38b3e486c4a10276203ec9a34496b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2058/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 69f527a84738a062a6771ccaf572cf7769a75883 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2059/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 175a023886f7765b2239e1845a2d498256765e49 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2060/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From efe4f270e9342c1d7bb06a1f87a7afdbf339bc2f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2061/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8f30f61ecadb0dd92061c65aadf4f69768ff1c6c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2062/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0e564272eb1f399aaef6f69a1859345653cc5fa7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2063/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3326a26cbd9d7c48b9be86bcae216eb84429f2d2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2064/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 52165d3f95399f0372ec4239d8bfa74a29af913f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2065/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 433b9cdf74bb84e7ab6a4e2a1d2ef94a7196bd80 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2066/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 005a1312efc617bf202bd452d3f729e6ed2d6e16 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2067/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From caf44e79753c1ea3e516fc778aaa1d847fb20fd2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2068/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8905bfbc4de15a06146a9a34c1c0106db4f54026 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2069/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1113c06f3458288e65b720de3edaa7a084b49640 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2070/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b07c216ee4556b5cca552cdea6df0a90e9500990 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2071/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0557eed4fbd0ef56d3cea4b4c5099fd92d3996b5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2072/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 74db03d952aceea023fe6a66da34cfe4fc312de6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2073/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6c9d182ad7c2b8a0754b980eec0190f0c27e6cf7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2074/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 08cc8db962039f994a6587327bc38f14d6a48109 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2075/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 043fa60474193364df8d9ee15c455788883d3197 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2076/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ff3965e983d4a90ea00650e2b535a0fce2a439d9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2077/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6067eb236365629ffd37ecae92a09ad27ffaf0b9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2078/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8cfa932cb94aa760c27c7f1c7f425ed1ea228af5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2079/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From bccb7b01f5bb0ead6a773e9ed9fca636a66ee42f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2080/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d5b965136817577acc4e97024e60c779717a5679 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2081/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 761fe60f1f6d9f3fb191aafc60f696b7c5d1b9ab Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2082/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 84f44d4b320623ea88e5fa4a48d6695427da9267 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2083/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b7747460a426f45c895d5657e21f6f7ce37999b4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2084/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c177f140d391419f81d8c7b55f0bc4568ffa78b1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2085/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0eb3c0ad3c5cc14f773e018441be07d491f685da Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2086/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5d85beb9aff67034ac96841e9d9ea4409a7f5414 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2087/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0e9a0a0d8aa0a9ac19dc13d465c4e4f2caed73f6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2088/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 66cba9740093513f68e66b3ad1fae76eb2ec16c8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2089/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d0d61abad414347f6ddb7b7eb5a5595d8aa1ee14 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2090/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 01c3eb21145eec29b8a82509a685f4dd533ac2db Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2091/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a34d95d504ac5d27fed1aa6ec48b0b71aab785c0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2092/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 45a8766967c0877c2d3ce9e4f52a92245f17d339 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2093/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d1ff46e22970c379ecd85b525bf7ba050a93d8ad Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2094/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7cf2f34939d8b22bf438da3a4f301c24f3e713aa Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2095/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7e15e000a7b58d514fd25f596acf0cd36e828ff8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2096/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 16739eaf5627c06ed54e6b8451c9b634478bfea1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2097/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d9de106b8a6de99f898a201cd7181bdfc9a7a24f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2098/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 45edcfb6dd068c122b57fb9f9d2a768ae44dfdb8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2099/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 79fc74214bc2bdec3aa347bc7d408a18b3d58512 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2100/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1d07f500626da883ec4b2933406a34fd7e86aa27 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2101/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f79d6de70c5853a977b1e6c31992ffef3f09f5ac Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2102/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cf8ff015f49ee3854640fec2902c77b83d94c1a9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2103/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4038ef17e7857877d65301541c13a92ca3f5e34f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2104/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 03b9b1f4890e7b4eb0ff8e8df9cd769621382dda Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2105/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 93f0a17682092b7c8fb2a8b64000edb2742d5951 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2106/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c4e1369fb6ea0f1c39b3c0e4de99310b45bfd0f7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2107/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3616eeb024369bb4a6925e923a6df7c4a9daa8c0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2108/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a41e366d3d573d41dd2513106797c950626d5fe1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2109/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0d21f96345cf092025efbaee414e0cb69f64981e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2110/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dccac7c353c0059fef3c8098ad30eb53eb733df7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2111/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ba8d8afdaf1b36006d29cc5c02070a1ac0b74114 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2112/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f5be258fa1d7496cce84943d31f5c4e43af6cf01 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2113/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5265a9d4b568e5b0a77e62cfa9db476556ecbd23 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2114/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c5a1a5fad92d4be07d50103edc3f9fd2a443e6b7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2115/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5bc481787885eecbf3beb95f97c7711a3d7fadd5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2116/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 19142810aefc4e1d96528c6e9fe2bbd223d62336 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2117/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0550591b4427db33d90356f120a44d2d41869acd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2118/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 358b783f1bc41d656f566ab7b99ad0265665c6e3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2119/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e50d442b9821d97ed702e20665dd0e92277349c5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2120/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 80f63d5946475979121a32a8362e4a1b9ffdd65e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2121/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 650e16e8713d5db4ddae6fe88ace3b240b7c376d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2122/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 299314179d32bc31d82668d0be282c305d187446 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2123/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ae8cf7a7331aa754eff8428a6cad8cf48a6e2ec6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2124/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 53449674d18f245c5360cee76bde17762bf5b3ae Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2125/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3b383c896bb7b4351d5402a198cc0c4f98e55add Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2126/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cbcaf232e9a5f19bf19a8548f72ebb191d7947f2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2127/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a7fb884fd2d60ce52a547491c787fc79c64044ab Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2128/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 33811061f67f73e1236e17111e6be30cc77d4cba Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2129/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4c4af1bad260b01bdba858c854d75b4a1a2d55e3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2130/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a9dccae13f6ea4de02b8df316ffec59789cc7ea0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2131/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8e235817e9e81757d7e0dc343d25b894ef47df6a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2132/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d4922edde6f9500413553ec74a64cb8b57775633 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2133/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8cd9f04820c7471725e55de7b2748e20c282a673 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2134/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9cd11fa7a919b11f6fe761c1f9ddedc72de0ef82 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2135/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 79c4332b04450a52464b3b9e01dec7dd44b6b2e3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2136/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 86dc8a7187668447cb1a6d767210ea782f997613 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2137/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7fed898b7bd7135d924781fd963b9cd2443be014 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2138/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 523d355e442305be8ea9732a86e1b27f4a5fd2e2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2139/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2460ee5dc97669e1fedbe2f3b604af7c78419b47 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2140/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From df787f033551fb5193e505fa33898fe0605a96e0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2141/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a86c61d149b2c29d32c0f2cce77baf650e133699 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2142/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7d3132aec09c5531a28a8dae8f05f77af4910343 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2143/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9d10b02a5005f5ba8494ed37129832b87d60a4ed Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2144/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 45720443d6286de0d0458d653c61cb0e253f18cc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2145/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 386bd9591d32fb0a2d6e1f82d4926ccc174214c2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2146/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 15f7fe8e51ee0b611e26fb8a26a806dc4c890d58 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2147/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 07cfb005a6e4201bd89bb8acc17b190efc23a73b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2148/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 845118296e40a2f5016ebea281e4dce033c5034d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2149/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1161608b5c670e387bf50a0b9a360cd33eeb238c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2150/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 482c1a488df808e3bdd6abad7a15a04815d3dc75 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2151/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 09af209833b1d1b40ea489d98561ef830aa56ca6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2152/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 60bef53581757ad6c52d0f8171e64d06a0d49799 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2153/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From eaf451313d1a9b934e1a748459507b7bae405e72 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2154/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 454804fab89748f8b1240287c0f2e852c4b9375b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2155/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 636b1b1d908c413500b5503e7f5f8b131091ee6b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2156/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2d2700f4054a297a1346463db55e03e31081a26b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2157/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9d2d2f957f1247c9124082fdb6a5b023056fca09 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2158/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c19d4ee0bd0d384046793e0daa5e001e4c902110 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2159/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5bb5cd476c5725be02aa824a6c43be987590e2ce Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2160/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cc593a68a68e60638923a2911a3ccae709d0201f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2161/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 45b06f8eeab05039ff8c9956528f3b7c86c6ff15 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2162/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 860092bec250119ba3f2892e720b13ab33f60803 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2163/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 263f9c4eaa60428d4556f167ad1716a1bc34d4e5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2164/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 63b79613d6b90d79fb58a64bc62bb0d4dfc878cf Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2165/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a58b71e7d2a7b752c5660b0b6eb12f7445310ec5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2166/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c8b7538130781a112ba97be76bec065bc49e92d3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2167/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4413424885bdaf1d8ab59dcf0c410fced4f77b89 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2168/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cbd3810e275a8d9c61a4f1cbc4e13c2b45c5a72f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2169/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 00158b1bb005cf5242f920470dcdcc59229e9c5b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2170/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5810691f1cd5fabb027cb54db038f8a30c6ba060 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2171/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7c76a397d681644a480ab5295220ad2a616da906 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2172/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 872fb6598582876f420fe3fac20e182e09b857ed Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2173/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2965129fb3a3dff3eb88b380eb21582c524fdc55 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2174/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fa9e2e44ce674da01cc5534add303e882a0e1f9d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2175/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 83aaf58a21454153648ee416149b1407de07dd27 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2176/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 581eb04d6a9e24483a8c78a1b45bd85713215d1e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2177/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7a3a6caa6be8529c75f6ab167cb4c9abd164bb8d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2178/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From aa842486775e85653248eb93e3f31b434387f12e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2179/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From aa955099240189e0d52986736ebc3482d31b7c63 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2180/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fddfd749e6844a8b2ad5ebcd2d09d5952998277f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2181/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3a882b6019493d2e749d8b34d52b962176086875 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2182/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 789a9ba619e5d65c180b7f526c91849c3c5a80fa Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2183/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1569b0c02c62b5d879010d8338f429726ea53d30 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2184/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 36f07cc806f2a469539398bf9b2caffc84ae0a90 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2185/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 230f6c368e826e5e94c7eed4fdca476e15e52cca Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2186/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d85f52a82b44aefd33d053f43d55321a69a68aae Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2187/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fc9a347c3115ce0823710463a6352c82bf40cdf2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2188/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8a1f1cacbe406796c044ed02c76d04b2f7a7f2cd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2189/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From baf55ed39028377566fc63aaf14aa51d6123f133 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2190/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 607abb01950669cfb62369cfb4588c56e1403bc1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2191/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 15fa6f8a2e7874d23bea8b33ff906a442332a3b2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2192/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d15645da75c503089c9e3ce9417367e83d439216 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2193/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From aefe04e3b565cfa6c121fbb481c9f10c068fcd7d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2194/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 79bf743ff84d4f6520758e72f9221a11dbccadce Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2195/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c2c8fdb0219378ef68958bc6ef0af90f2078bd5d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2196/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 06ec07260175bfe92db75a5b6ac7d19c6b67b848 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2197/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b367ff0cca14ecf94f886b8fa4cce0edbfe31887 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2198/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2bbf4d01a0e89d3b64e30d01f11be7476f7010bb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2199/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 409141bbea9997235c1c7f2bc702aeb04f5ade07 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2200/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 66e700f0c17c723e97858672fa3b109b8fc80809 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2201/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dac3eaf2ff00087a06b88eea4954efb5fafaeeaf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2202/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a6529f888608ca68562a6df4c25899a81aee0bc5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2203/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ffbc6d2fc75c2db82143d92ac21dde98d2a1d17d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2204/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 98955d13be720ea7c26975ff9d103002ee91fc1f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2205/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1add1d2bd7059d630da200890f34ef1dc775a848 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2206/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 59e8e33d9d274c7581af13d27c344e5ad6c777a3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2207/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 05fd9f4379797372888d0a63f35b8acc28adbfca Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2208/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4962d77bd1212ebce13acb0f9e31eea3ad4e62a6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2209/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 630f43713b6233bc90f92d7f9db455e87f4771e2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2210/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9977aff712c79ebb1a3aa3b53a8f6edef756b636 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2211/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 130fb7ac056f4770f6b13bf90b7b103118735702 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2212/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4e897dddd4ae67642790fe26c32de722b8508d81 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2213/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From eb0e2a1254c5a559dd1fb1340bb1ac9c735751ef Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2214/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d921fe4cf7cec9d8ce77881f2e65feb38c16fe85 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2215/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e0f621d8ef2c78d69e58c838793f56948139d585 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2216/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 78bb2f3be1890b6be500602ae5908d7586bf7c97 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2217/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0dc8f3ad826b7218e410fecc2da7557670cf93d8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2218/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9fe830127b4a8b5b7b235ae152f23d1e82de7d73 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2219/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1ec97218b67840e57d7e0596b8700704933ac821 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2220/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7161769ea71333885d33053b9ed2fd11510c9034 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2221/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 09375836fc52b9c3dde391c51c402011faf4a4fa Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2222/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 72fafcd8ec973864585082f1d03c0b7d05f9d168 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2223/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cf011f7067b9c5763c346a67d38e4162119dc615 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2224/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 245bc3c5bcad464981b29c57c66ec5ab857a102b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2225/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2ffa5ec387eefeec5e94fdb872ddf0bed70ec602 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2226/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 20b8eff24a03f52cba9e78db2b21265a60e70435 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2227/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ba27711a4cc919a42bd6d8bbbfc873503f1d52cd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2228/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e604a5293c065be009b4ee826afb437456dc9966 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2229/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From aa5d61c1b9465609c6507bd3956a8eabf0f2b742 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2230/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 412c6d7c21a220f6dba8dbcafa9e756a62f08450 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2231/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4110436dd7c816ee378fb2385e4dad4d9e0ab4ef Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2232/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 73d9319a1f2e6f5f1cca0856feec0947c83cf5ae Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2233/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 96113f28e90a161ffee40012b88032d5effdd731 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2234/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 73d93829b909781b1834dadeef5c2883930c5958 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2235/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cb9b221fde56adf0726cba3ab5a0a6befc22848c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2236/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0a1aee05298fb681059df609a35e42112a7033b6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2237/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 76c6faec2d37dd9672b8782931872b8af53fcf87 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2238/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6009d676d91b25a620ecf76f4635e34f7b17f1ed Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2239/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 379913838312b52766863a99922741f5b0ba176f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2240/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From be1f535b53a8143e21155182220a54638cdcfd0d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2241/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 832ac4937989f8d4e6c432235988f5abfc17b64f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2242/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 408c64fa4f4adea1df5380c62f30158ab51c080c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2243/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a9658ff254516183634b146b70538e6b6dd20985 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2244/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d05e26013538ca388962338de5a267de1cb70bfc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2245/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From bef6d7b9fb5127030efbc372948a860e3ccf13f6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2246/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From de1e359044c567ce64721c11408d3e86b2bd081c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2247/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c716d2cc0b82bf339230299abda86c2809b7ec16 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2248/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0760322827a8048c0768376c302db1990d2dc65c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2249/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7d17fbac1232639412b5ab663aa1cd345fc07779 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2250/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 916877eba4dfa10d234d4ad6cd8780fe07718688 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2251/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 81afd9957b468a5cb477d499245aa6d3a4d59746 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2252/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a66d87b7a4c8f57627735fe18d46f2417e4a37dd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2253/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9b1b2f1ab981c3371c9f96d5444fe2719ebfe560 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2254/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4c631ebd1a0e2d6d01ec7568ede863d787c3b105 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2255/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f3e08f22a94f741e75f2265f30dfacd2d72f838d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2256/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 183e46db79bf2f967805b45e19530750c96c63d7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2257/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e4c380ca2f8bb146821859b2838646022e2bcc7b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2258/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ffb3e63b763466e93149d42dc80b7a1432a5017c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2259/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 94d1866d256c29d1b4d0e67fcbb4ec86f1055cb1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2260/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 13fd733f31910082ab27a2f07fcd9ce0041a3b6d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2261/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a7e8465281a6a7f7b0c06b59ea7858b3aca0e757 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2262/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f9be07f7662a05eba61a377ad481750fd7f80659 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2263/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9cc6853351955a1506e2384807333ac47877d801 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2264/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b75c49113bd717442c0f7f5c14ba16586beff9eb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2265/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 68c768fa88e70173710e61589006133b11ec299a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2266/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c018e728a26d709f8fa1233d4cbf9db1abdeb075 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2267/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 40b2df68fbbb017ce5c9c1f10cadf307dfadee9e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2268/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9c02b76b15e0fad2c55b8f86e07901ef5d2f6917 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2269/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 104756258b5c210482c84f29faa537b3adc687b8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2270/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d9810871b8ea49079f2f19daafb53cf14525ec4b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2271/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 45ab2422f612e17c2c9ced34eb32d42a082bc83f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2272/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 25ce65195f1b6a4778612d3e2e910fa0e9350fa4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2273/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6dd87d38345d5a2a337c43382c1cfea5220e6224 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2274/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 81b6bf1b9a0a3930ede08d5b34312809b4131127 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2275/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1f016457a7433da01f16db72a5aa626540a5d3f0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2276/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b519d628bc0a26f448f2e00f0be736757b111bc9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2277/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8f581a56dbd43c504b8c090a7ae7525563932805 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2278/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d86781ad3a625109ec4083e4a0979ea3fd9da2f7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2279/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 51983050fbb61072d26d739168b2fe562de2abfc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2280/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f9d655c6d30b747936d5ffe81ea4b5c484ab52dc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2281/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 03ffae63c1472c69255a215d04689488badcb0b3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2282/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4746a281b7e2c69bd99cc4fede4db93dfcee638c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2283/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 392c665bc8657bdf379b663c6d7b0a63366a45e3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2284/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3dca25122abab8974e2c9c057d93eb06d49dbb75 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2285/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 252aabd9127a70d77878dd56480e1d8d3e522c8b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2286/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 166fd14904f3a2e6a2e6ea11a1bc8540444037ec Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2287/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 999a476a369be92f1e71586e9d91a94155fe920d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2288/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fed2f6a76785496ec3251a2923a53c0da8076583 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2289/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From eeace63994144f3b47b98075c538421dff85683d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2290/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0df960a4a516c160cbad278976f3d277260a7f21 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2291/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 831772ba6fb728b01e0c699095347418ec5270eb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2292/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 685c06cb8aa5f21b725cf60098cbe8c173d2bc6a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2293/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 75f241b27b80a54413febcfd1cff6931c2d60255 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2294/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From db5d9e4472cc1707d1a7f634ef4512381da9c6f5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2295/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 06e0cddb5d23402610e5b1604d6f43a26795c9a3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2296/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From eadb82f2f28761c3235a07edef6e7c0a7956d05a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2297/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 39933e96b7990c6e4fc0c847c4563af07ebc3e8d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2298/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d7de3098e08c5a60ec0e8061c550442b681f7e47 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2299/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4ebed30d0b88a35e0301bd255608b5b462a6675e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2300/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f3034d3e93e495e3069fd73259d0bb0c6eda9b0f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2301/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6d92c4cb28f1ff506c6baca08cdc8a683d9bb829 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2302/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b704ce60ad9072cbd6a2449ed4485fb2ba6bebf8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2303/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 91782ed631593bc0f4adc146fff63b4071882580 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2304/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9f9410f9df5f4fd25b95eb2dbe243759b95cc93e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2305/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f2585371ef6aecabd5dbba67a185f9a590522bac Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2306/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 471f99c47801948ccde613cd74115ced44d809b3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2307/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9b456956b9661a3aec9c0c533bd9e8c511be9534 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2308/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2d78a9e413515d44d6d42bebf1d6022871e27076 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2309/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c57938cc60577a926316f48b9627fde4d042bc6c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2310/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c82bbe1a81e04ca7adf8d34f83646be01f3994c0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2311/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 46970180b48e643e989f229e94a38bc359b0bb2d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2312/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 00972fb50dc423567e1cd7ed678d1c8d505d957b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2313/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 852e0334f6344085e2245ac2517725c38e89e177 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2314/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e2a97da01f077932de1d5ade7cce3cabcfbda850 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2315/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From db6c81cda705c483726ac7d6d82671f37038f264 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2316/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e4eec47ba0b01c397a9792a68fd5ed71d2c461e9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2317/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 92f896c183d7d2e79dbd5e66d41cc8228d4aba38 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2318/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9cce63cebf84fb2ce601cb47e1dd71ab24e73cd4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2319/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ef8cd406a3851c1699211068647fed56501438e3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2320/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 539d0fae47c1bf9efb4410cf9526f601d7518aef Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2321/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8ae999ddc684ac91ad1624020906a115e121f693 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2322/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4afd795dba13902a8707c59790670e8e770e5942 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2323/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f84d04565916f6aca952467235f5fdcfb1b82365 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2324/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 486ce47f8332a10232e35b1262b3ca31a54159ed Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2325/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6c6ae3aa1704581f4264bbbcd1f2cf250fe4f4b1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2326/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 300c7efc83165bf97c7d5f382afbd03c13e62453 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2327/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c0fe185a09fc526750b47fd177ce7bf7d86af966 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2328/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 286c00c923de10c2f26b7c9698bc2eea86fc0fa4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2329/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 19b8b7356d0a1844acce7fa5e97761fcee5cba1a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2330/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 704379aa64ec32e033fae55f532273028ea406b1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2331/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cc16a509b2a2aef2b8ec513afcd8f27301df3c04 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2332/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2e06ca0d7551f7afc3b13b38a29f4eb4b8bdb6ec Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2333/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b0cf160c60fb057dfa78ac66bbace1b0b5aa03a1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2334/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 68173a75d69776828f459b5fb0a76f12205e4600 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2335/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e82a8831e3b5feee3112c06878171ec66fc5b46f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2336/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 64c620a92d3c905cedb20737b510173e65d2429b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2337/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d94254361774c7e6809e5b2b1256d7efc4798d49 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2338/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c75d34e361547dc0568eb775fcbed68e306644d9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2339/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6c3b8ad486dfce173a433e01169f08729bc3f7da Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2340/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 98042e5905be2347a12acc82edd490b78cebd869 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2341/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fb9d196dbf9dd762059fa856726aa8102fe55869 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2342/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From beffc0ecfd64c3b5963df0ce0816b841344bb331 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2343/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 68003203f0d12990ed817b73c38d558a13e1a4f3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2344/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 868cc58ff61267c3a1994cac19a72c82626243d7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2345/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fc552d2b9f2508e7549d848bb06ae7c88468e3ff Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2346/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 997a698eac1e7411453fe8ea5422797acc4342f3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2347/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f50c8347272a315a9c875284b09fce32c711566d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2348/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e86584f57490642da43bcbba86d70b608b7ed813 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2349/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1a7a37d470ae55b51ac157c598353245478d06ee Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2350/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 01bd3996dca489bc8fc43c1f84d74cc6732ea7a8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2351/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7ed137593b92516f1d305a0c5eebce7e271cb6cb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2352/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 19b2eaccd3902959fe9e8ecdbc5a51dfd547659f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2353/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fb338f8f109365bfe737cef52ddc8c09a4f7729a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2354/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2fda4a2016d5869f79aba00c09c7c7215ab4b31b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2355/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1bf4692fedeaeb1c3fb449e08061ba22dbc3dac7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2356/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1c99c683863ec0362313fc3f9e8c5e3bc0551206 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2357/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c230a5ade3d61b5ea601017ba6eaaee025cdd8b2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2358/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0e7192433aba4fe982e77ba04bd8aa8300611ff6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2359/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f292ad8498ecb856823b0b33926a655e3fafbefb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2360/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 564316135be7ebb134ea5086e201948a15f2b868 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2361/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b6b5d78f067b68db219801ba56851efecf788521 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2362/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fba36132a09ca12115c8e63e8837d23adcb901bf Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2363/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ee1fe7beea3465e39160fbcedd8efa4b96e51091 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2364/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From af2a96033654064cdc330f7b52015589756cb301 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2365/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 806956e3ada57988dca5bf52a8c358cc1ac68e1a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2366/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7a4226ac96f9ff291ce140f6828030e8fa9d8f56 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2367/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 251c3c2c6efafb6e49322ae7d17b84a342b6a89b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2368/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cddbe25d6c73f934163c5d3ec6a68e0e4f6b8652 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2369/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 741cb9b1101d2a0e9b545651939423fa8094ac7b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2370/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 58f6e7c7f94f90acf3d67126d39814412ca95db5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2371/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2a8714ac4a34cb7e080257cc90802726eb076156 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2372/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8a8c1a1841a4fb84a78376f58ac5b827d524dadf Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2373/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8088c84f4d8f3f8a84605f874909cd6e12a797b3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2374/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3f098d398789f054d22091b6ebd390546b833329 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2375/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ae7a59759537f00e3ecc3764c805500054548c7f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2376/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 923b50aad29805708024d7f4acd2f57e982f1ed2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2377/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7c06e73a0331929576b4a6a68bc57992752f058c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2378/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a75543755c8433d32729989eccff39f10a723340 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2379/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d329ab080ff2c16c287272a792cb04f68c670c72 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2380/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f4af3eb19e9019a621e57ae20f3c2cc03a0b2831 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2381/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d30ff216c83d15e346372e698106be99f2bdbb98 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2382/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From de4940e9522175f08227085c487cbc035e4bcf57 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2383/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From bb9e62e59f98552654a0a7c81fab14d984a2e12d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2384/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e5d34558e8ca7b20480631be768badd1564f263a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2385/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 118d5e17642b72370f6f59c4587563516f7d729c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2386/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 64a48c4a8a0b4897f955075bf96c34100cb93625 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2387/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b3d590b790de4b9815b39f78128a701a28603d27 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2388/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 60001284756d7902cca24ce55dbb925da310d9a3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2389/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9457ca7893b5555064558f374e2b805116eb9d96 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2390/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f658bdec12bb1517553418c48d8078203d95c52e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2391/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 544428e2e5cb00865b2917503018d263d00b14d6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2392/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a212f64b318c8228c632cc87af1bdddee323323a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2393/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 554b17f155788d4568b4e53401c0a5813c306069 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2394/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 05536fe1b97b7fce649bdf0adc2cdcb7a1815b3d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2395/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 73a302cc75504e2ff0204e12dbf9c410643d7ae8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2396/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d56bcaa5885bc4e375c2d7a36ad58807c87289f5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2397/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3ce6eb1d029cf7276f63efb9b9f854a4fbe2eec1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2398/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ae83330ee6f4bc6e19f0be881ae9f65118b528eb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2399/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 44645d54cce227da7e260a07cafd0d8997445d07 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2400/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 910cc37ca1ae2e7e9b2ab55b4ff1374fa3b982b3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2401/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d691cc829b027b26e2c613636300273565e64422 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2402/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ff58c30acb215e00bef39a011d52d9311c738680 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2403/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From df09f1468699f5dcc24bff0223d2620e9798d399 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2404/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ca809cb69b72bf096004c0a286a925103b4f7099 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2405/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 317ac3ab9ed32ec3380723277979f236141b1534 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2406/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 050c2a5756690ae844b186cb5e9d4c82c0a4b0bf Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2407/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0cd76c73f061193f2fd28cbf7f6161c6ae28239f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2408/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a971e08a7b0bc0df77cd91455c353a6944930503 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2409/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e46147eabd3426a571e81509a2c11bd02f88f5fa Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2410/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 82952c7455ab85729fe01a55ff9345937a47a923 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2411/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0021cef6ead3fa546e942312ae07786410b8aba0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2412/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 63d12f190e67a1f8c6ce26fd155efadbd5d15877 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2413/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From add38fa268af5c116dd2c82e23a7d5b0c5e0af42 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2414/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 053bcb2766759fad7fdfb11eaded356d48bc2c9d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2415/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 950344020f6407521f9f75198ed13321390c2ec0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2416/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b00bb4c9e0583a751a9737a0f03c0155bca67c80 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2417/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b32d1ca73e6bd9f6b412b048a183662296a6b09e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2418/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f451bde7d9d2a7a2bf0d2bdbb0a165fcd88a37c8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2419/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 013bcdac7e78ab110d979317f17301566ee51112 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2420/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 65128568d674cc9e948172461b362aeb91726097 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2421/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 30228caf5f25f481a42db514587adb5364c3b957 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2422/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a95c243294b98e999421ab398f3a6a5e64e508ab Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2423/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From df2ddb5cc42aa3bb2de30063abb85ee58a43e5fe Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2424/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 11cfcfe86e112e0d88013c17f8b8575806276bee Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2425/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1066402e943b5c98e07fb6f59abf689f9eb2672c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2426/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 005cbb6f9956d51cfe60fdc35ed2e66ee9f942c1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2427/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 207d20a71049de410e4eaf9f086379f41c29057f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2428/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fed20c2f0f472de8a80669fae83e5d55b8b15fa5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2429/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cdb9c2c32e71b934c50826cdd3a343d95b033f09 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2430/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dc536294f910de9fe197856a2bf0ba1e6177fae5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2431/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 40a3da326432857106cdc288fe65ad0824a909f0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2432/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a7fa0d13057818688f1d7f71997e14c5d972a68a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2433/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 29ee49be5a03cafed8674fc113a25e0dd812bf24 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2434/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 898c8c0f1e1e24b6da4af86fe5375e7ea7eafeec Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2435/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 17ce70d409dd83e0c68ff5e1b148ab127319d3be Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2436/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 14029d343b04d8ce2651bd02550dde3c15cd2df7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2437/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fa3026581c62525921dddac388f2095c477bbc72 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2438/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4008a4039da11ddc5dfbdfe8f3b880ee57f7c7c6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2439/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3f072bab162c6d7bd234c9ab675b4fe0152f67b7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2440/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 104111e07145273c3140e8e93dacdf81b1ddc595 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2441/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 04f9eedfc38573949a8264ec60bb28cb83810a89 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2442/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 659668d3d9d115f0125503ef825094b261b76c2e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2443/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f8c78fb7fda0c4763150278d77d466577bd92c01 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2444/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0447c6035383baf64a565a8f8dbda2d9a5268255 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2445/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8da5838ba5c9e9adc3b915450d8e720aec8f0696 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2446/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4784d8546662aba3135f3bc6283ce727c36671b1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2447/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b1ed71c243ea32d7e27bf5d18fbe705242432dd3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2448/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8f8eb8ab28d51c31d57498ab68942307aa402732 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2449/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9d8b0cbed6a2ebda89ebc7634e2d9ae72e733032 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2450/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cea845688474119668d55d1c3bd9f9f37e29d1a2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2451/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 688763a5ad1f9d507005db4dd8e63acf8f7cc92d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2452/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c9ba1a1d49257bae3d77f3fff8a14b87e3cc1ddd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2453/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 71ec3327fffdc2619a9c63a2d0c37dd96195eb49 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2454/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 95ff65b7661780ae1c8f2e087545df7921077dcf Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2455/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f8dcb0ce251b917882932214ac6fd1d530d20fe2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2456/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5fc1a69c1cc31454abe58e7450fafb4a73c246af Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2457/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2fbb2f09b103fc63a40e971a023d1d6b385e1dc6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2458/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 42d7b767a0b3fe5bf094b77c654001d1814c975a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2459/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6058e03c90087bd8de2c6878f9441718b94cb6fc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2460/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 710ca6cd6cc228e3ea4c312f86324a22557b4c62 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2461/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7be6dd5a116d56eec972579b2502e43f1ca5f37e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2462/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4be048af1c98ae4399f1163603446ec7cbcaf82b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2463/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e007098eb9776011101bfb82707891df98f7c4e9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2464/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d951514a02f8e32a575689d8927dfadbb38d7c66 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2465/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c5bfde404bc8676a8bda4d7dadee70356d6fbb7a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2466/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0b32436348affd90af263356474365f6350fcb30 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2467/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d83d610cfb507896b60905a5404f91b20c148bf3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2468/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 37135582391d18938ab75ad4009b89b1f1dc1450 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2469/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3db3dc4ea9a36e2b1a06a1872f32b096c478a014 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2470/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 91aa759f086e7adaa0d7b7ee011899375f048337 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2471/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 31c3750de6dca4189e4464aa99812be1cb6ca4b8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2472/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b90c0d641765eed32a024b940734f386885c9371 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2473/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 296ea686190f70607ac4aa41307d1ddbe2f26ce5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2474/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ace66b6eb6465dd11602c451f1453a3a91726146 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2475/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 25e6357ee6b88f68de61b99f9ea2af78b410736f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2476/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0223e2aac225ea0a7e93dddd7d3a743cdb7748bd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2477/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ca3bd1cab7255390fdab6855d9a4e0f587f91f22 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2478/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e0a22616f99bd2e57de307f333b4c9498130392c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2479/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3f16cffcb2d9a031ee14bbdff50b4c119f7b7087 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2480/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a5f2d881dc850b51e88e73c41406e4ebfd8cdf75 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2481/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 960e06152ddf0d16049f7d74b4b891771026fe36 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2482/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 49c7295f615900549f5334f7ac4aa84d8db4f412 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2483/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e776aa8af222752baefe1460b32b44301d9347ec Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2484/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e41905d6778735aa28f6905f13fc4b0d5f8654c9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2485/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 659c54be1ed4fece1d1a952bc7e4a78e2e8a9b8e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2486/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7f7213eeacb8a459ad9a247389346ff2d8e2206c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2487/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 71fcd0eeadae5731986c2c6fccafcaa98c6c82c7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2488/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1573ea48d8a31e1c6bda9e2dee812441938ab54d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2489/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c01849f137e17063ff98a6cadcaa4ac90f0093ab Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2490/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1da94dd07b4f0aae569874949fd9a66abdab3dfb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2491/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f69d708367ec5ac08dbf3db4ee4be2244e61f9d1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2492/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a0469c669760bb0be59814d536f8332d5c6165e1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2493/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 82744064d9f4ab06e8ef35947ad89101b2ce9823 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2494/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a5f23cf14b6748128286968c55764a39db2d4339 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2495/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From aa634fbe5bf0b3606f094e5876048bb00f88642e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2496/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 631a45c755c8019b5159c03dc29a8d4e0cdf3a36 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2497/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 947814f65313d507a6371e5dab6818d784454a53 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2498/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2256689f5588ea71826bd56ac3c92ca9a26533d1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2499/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ef7eba048a90467bf1bb6eacd9d4424d50fc1710 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2500/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 85dec4fd923e30a4f820c9e339d8b81decc66236 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2501/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 14c3ca25744a6ebce6d211015e7af802fbcd5239 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2502/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9256771dab4cc822b86e5bb9b51a359fc85d2f0e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2503/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9a39d16c5d12028e96265ce1feb866e35ed93110 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2504/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e95c5141b05b31255085b63cce0a2b28cbc800b6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2505/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1409807f22a48d8541255f937174421516a7ae2c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2506/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5a932267aeaaf4c39d389dd9c4b9095ca9771310 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2507/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3f2641350c7bb74921b2cf539cfc5863b30d5065 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2508/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 667413c5b082f815c3242077ed37564e6df7c4c5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2509/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3c9e88c4b0b53cfa76b62c6564130004c28cde09 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2510/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b0d3f4b4a7e9f3f82a25c1bebfafead469db403c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2511/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ad8c30bb8f17f907ab3927f61514e8553ab6dcd3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2512/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2fd1bb7fe30c77d8393affc07b59036c842b7acc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2513/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a75bd11db7c18c96a44cde6848f31b1275db4ea9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2514/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 615b5cf904cfb18c998890139f72b384e9b92132 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2515/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d2e5bc806e058f23908d863d1e9536c82ec99878 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2516/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cc7c790d9d43292b8bb1a351a3f0c56973896e1a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2517/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fece6346be427f20f21b6d09cadc738dfe2b5795 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2518/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7e13ed0d40e7a5617e0709ec158a5ae2fb262a81 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2519/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1708f70515d80f10df93419ac9273b7286c4312b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2520/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6695a19d248a7f5522cbae07fc6fd800f60b0937 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2521/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6b4510fb3cc6e33b85157726a2e312f77e584357 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2522/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6684dcce17842f084c9b66d2339c104f6920909c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2523/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9c112dd3e513cba2e551af1b4a83834c357da8ab Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2524/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ce858816e402b31925aa683eb3974296c5bb0590 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2525/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 06ae55dc142619c9f34f932a9db5c7e760b7721f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2526/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 266803245325fa60718b6836684e2701a3fbb90c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2527/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b57cf794d8e632a9b05f30d0289decf3fb391e5d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2528/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4203b088a5085d6d5e1e41834916aee033915368 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2529/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0e40012d9d8b71f85b5395f08ddffcb5c108a719 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2530/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b053afb78b6947e7358f96be714eb84f50efca34 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2531/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3a8bccdaefc1143844a03b6771cbc790072b539a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2532/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6bcf862aed3544c3b295e97336d09bb916420353 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2533/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3bac9f7fbecc53a4e1dcdfe46b46a7b56c16ae7c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2534/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 48aec57bfb40c0028dbea0d8748945dc56e05c4c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2535/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1aff982466b964b2d50bcb879c1c264bb9f2c9d5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2536/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b59a9ab1782f7890de290a8e73d68a9dfca5f6a0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2537/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6f884448b3e5c5883d66ecd7a5a0fea1aa101e95 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2538/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d13ead776ce918bb40981455a0528cbc136441c0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2539/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 008e8a93b2d478985ee17443ec5004e8c5a0c7f5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2540/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9b804bd979b85f369139605bf4700cefd7467a49 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2541/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f083b8b4430d8f748a8c260eb3ff260a67ccef76 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2542/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 046fd26e8e805f0229f7d65b7b671a818f7b78fd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2543/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7081b879c749595a18b3488790884dbeff2b6fac Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2544/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ba8d3232bf357e288069e4eff6123cf395e56c32 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2545/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1c03e699a85d02f37f8ecad173d0cfcdc6c82694 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2546/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d252119dd2c26abfb1ceb558f26442bab1e3ce4c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2547/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b2251311c5c55dc65fc6431878331b1ac34c405e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2548/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7b7a51e8135bdc2f9789696d4b1dfbc10c6b4c8f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2549/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 99a7d6d298ef8166967107729fc9b154575f1f72 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2550/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a8f71708f895898041149c0f0b4b62a1b85913ce Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2551/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f303bd392633ca48ce04104469756b2126b68d15 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2552/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 679d66afdf027b2cea5a93b97dc0bc2772e3231b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2553/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 52bfb138fd8ea262ce854e832c3d6c7b8f9ddcdf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2554/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d9d809476091eed90a150a161450540d85288d54 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2555/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b4a0e49a6f03df1a004c4f05247375d366b49088 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2556/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 26929fca98893209bdd146c4787d95dd74d0d42a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2557/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c9125f070a6ed00cdbc0a2ce84d8a2a9197224b7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2558/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 38cbf7ace73a98a5cdb78dbab191314e94908e09 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2559/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From adf494dd6f3893ebdeae68efabe0f181bcd255de Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2560/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 11f1ac22cb9f4c0a51611149f78db6dcd97e0f0a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2561/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2954e2bbe7fd69f8f368f0aee010d91778e85ed6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2562/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 39ebfb4d0d884b52f5b239a4ab065513a8401f9c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2563/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 968d64fda9af1ed41d171f38bc22673b40e1a0dc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2564/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From bcea8e599275195b43f279ad40a3565f47ec083b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2565/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From bfbc16b0cdfacfb75ff2f9762031ebf83a2f9283 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2566/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b36be0145f81aa29dc104707c6712ee58885a072 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2567/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f8439ae1d2b065632ede67c319f11351f07990e2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2568/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ae7256cd907fe14d77e6adf6a30ad1c0ac8960c5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2569/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 178ccfe5aabd0648635264e1dcf6c42cd024fab4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2570/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d72a5138201b217e9c8caf8c30839a114ead6d1e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2571/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b11023c43a967f5700e034eac6b699048e8a9e9d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2572/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9ff7e3519f11d1d28e2ef5fedeca3448d5b19a1a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2573/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0c3e07010fa386cd8ec341c3587afbd2b48d0f13 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2574/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From aa737176bfa43d1cdd42490183e5504819c44b07 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2575/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dc7ea5e55b1b8cb2532cc98a40ba6e585899640c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2576/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b088a64ef61d5fe19c76db0f194a9b84f08e25cf Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2577/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 81e45d80993da5fba212cebb83ed411414a47df9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2578/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 911a39c9173ef830e29356bdc7670473d34af642 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2579/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 107a5f31d40e1852e111794ec92d4113d83347a2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2580/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 04afd2f29876f6ae88158ae34817fdc8581d9e53 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2581/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 53e1db8e8e38afa5e2652ab5c10dc7be7efe440e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2582/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7de9080fb24626c18eacdfadb470f154dd898d93 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2583/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0a36b79ed66dd4c6ea7fb217d496e67f2785492a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2584/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 73044255537a481110331870a252e5df9f6b5383 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2585/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 13f0fa45a2b34f51b777632c1004a8da0085bd89 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2586/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9e88bf764448335b7ae610e936254798757b8dd4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2587/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ca327defbb69a3659786a45c33f5967c2366906c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2588/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1606cd37e55d7453e9b8cda323a9e68e57b5f7c8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2589/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 93ba4071245ab46fc7865c01ed251dccc55d5a9c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2590/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 194fc754dfed1e5b5b650c84fc29245e564f676b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2591/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0a2002fc86bdd7db7704c1048098d344efa06e1f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2592/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 73b97bc56ffa9a98331b06b134cb5e41499f79b4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2593/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a5fe050506da6c0673e044eab86a11c4100d8462 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2594/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1a3177e43a51797ceff1dd861622cb54e52552f2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2595/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5f0b053344ed68107c52dc167ea69d301d5e37c9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2596/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 64b6702eb82ed5852b91a8ef620ed62488766fbe Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2597/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 347e5ac063f7b4d1e94544e71a819706fd38033e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2598/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6a430b0ef7a17444fa0fd7a83d8e88717a3d1905 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2599/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0545d48b0670a5bd9834d046bf4bacd8b5af86d7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2600/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ecdfe25d5a62c9e0f48f48cd4af9238592d3bf61 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2601/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9bf686c387957921eb1c44fb083d576ff925495c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2602/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ffe1e3f17b504373947e1bfd39af4556c44fd579 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2603/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 08b34342cb69d9607864e192ff5027d3653b38ff Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2604/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 039ca06a6aeda6d1bf915b1c85a57dbde97e26b2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2605/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c31992a7ddeedd55443e2d353a20aa332e3b5ad7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2606/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cd6968360a54afa79633ff7c3a29a1cbd7125380 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2607/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 46bbf110538cc8046ac72321fb1604c585df10aa Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2608/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 202e479adefd3b0aad364de656d9aedde83dc04f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2609/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 497167471b0e8adac66eec43122e82df0379c0eb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2610/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b664c6f865e1a6a37f0aea6bf00b71714f8c5bb7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2611/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ea95f50232fd666cf8b0faba61fcf872d81a7846 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2612/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7d1fe8dd7ba4d9d336efe583a26f61091807ee17 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2613/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7caa662c866d50ff0df1aadb24696cf00f3be25b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2614/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3b191c4ca8e29bea4007bc4a887067a50a44b6f9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2615/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b902e6235c10b17f47e26f702c26d68c579ffd84 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2616/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e08d3ed69fd648a8045e575e7186c38d26030a73 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2617/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2eebdab0e4bfe037655c39cc53e53067e24980c9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2618/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 708f71e7ecfc9b4653c21063a50eeb24f771969c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2619/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 45c1e8602e679255376beebafac783689da45c88 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2620/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9b2cc611f9d819f1ef1157d81e1daa7b91dfa84f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2621/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7597e24f491e129ea31d29b175ae7b15dbf9a47a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2622/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d8acc24dc99320f72aa78a0353cd401e75302afb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2623/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9b1a277bd404be763303ee99c524b7bff5ade1ab Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2624/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 15ec508bfca695c13462a748bee4683089737651 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2625/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 19370b61ea943c7d1adcc81856ae786a37d054ee Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2626/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f43e0c9b1f5c56c5bb2248afa610079c170a6645 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2627/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ce117585f275e75b5365333dc232d569c22531c0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2628/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b85b01bf64920176880d2b0550b9738973343269 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2629/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1c31449d880dd961e454c16f049a0e9bd801ae11 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2630/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6834d21b88803f1dfd83669ffd5f27d166c0e3ec Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2631/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f79479e6c042d0ac3d298475e3a0d1cc2df2321d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2632/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 70c56e73a932f54dd34f42f8825ba4d901510865 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2633/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 92e107a160f7ae12d31ed2b51e57769b382bec4b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2634/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b69abda345fc45e56e6a81e9c2b446b11259a31f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2635/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7446b137846c9e1a673df910ad2a1dab4277af52 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2636/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 11b508846f6b1e9a7f7ce0c87c2f8410b951ce58 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2637/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a35db5ca9ec76444e0cb0ca4032fe52d5ac8b3c6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2638/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a59640f0cd42035689857de849b3d7183da96767 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2639/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3c1c7aff6a35e7046150c5b4e952dc3f7154dde9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2640/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 822fffb0cca744b2f933e1aa52c4ddab4125696a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2641/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1575049f3b9f301c989d359040eb62d608f10bed Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2642/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c68b5e0e231228c3e363178a05d18747c539e5a4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2643/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 16005b2f62188251a3b87f84126245dedbb51d7e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2644/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 57d19074f59256f3e1e4c9a8814eef0ced7ce6e7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2645/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8dc13a4ac9bf333dce1d9a8833bcfd7154b64251 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2646/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c6353229193899a32204d912f36be3f20a9eb0db Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2647/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 65fc2886700686490bdad504cccb38624f882282 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2648/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9a0be4f5408d36f8d43d839b6c04347c011279c1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2649/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b98bab5d380669c5acd2a2edb0ed03aad250b46d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2650/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b31be34b6fa35903322e40f9571996f124a18f7e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2651/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 02c974fc87c4b3283b516e9206a8e0ae48837b52 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2652/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From eef0ca59ca4682b9325d54d5048ecee12c01c544 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2653/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b2e6aa383c56871e561618bd3ee9918362513d45 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2654/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c5330a4d6b090e6141b0177687b7ad15906c2bf6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2655/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d49972bd6a5a59c8f953cf8680504a1d0e897b61 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2656/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b2e86cb909a0ad9ce965694c7d7c7ff610577b8e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2657/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3caef6c316873d2e2c29f571b96ef424969d8264 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2658/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ae2211717f971fcef4b8b5406079cebc0780db70 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2659/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From baef5a95bfa734f40269db1eb3498a14d2ea8a66 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2660/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3c79e51bd3e4271983cc064d7434eba04aa6ee2a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2661/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d27c1bba656665d2905440f4854bdf3ae94f9a25 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2662/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9e6468fa489523e287658ef240d8100a0c8887b7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2663/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 984f5aaeab7711eaba6439ffe440340ff940996d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2664/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 16e04fd8d6d6f4c9724806051fa4eccbc1a99eea Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2665/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 942ffe22fc973ed68dada346087191bc33d3c408 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2666/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6cc8d7bdec6f275142012b84bf3149141dd4031c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2667/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fe65254f5af441e1cd52a666e00e2a2392eebf06 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2668/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5c96e15824f4e2f2aae2296ba0eed26f3c72591e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2669/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 900f3353d3f33c2ca2159e93f38bcf2aeec9a45a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2670/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d2e68561f429bb69db41a60f27841a924b980fff Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2671/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e771684ff484a55a41e016f42c86b954f8f3389b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2672/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0bf18172e337bcc10e91593278fa116fd08199dc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2673/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 84e1ae271873657a8bf521de8507b6a057d981eb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2674/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5ce7060a0aaac5b88d05973537c632e0923fa88e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2675/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0ef27141065477fd97013692771a3b763ad49cee Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2676/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 455f5261347909d0a21bd0176bcbb0b5de03673e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2677/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7a8588d8382fa4ef64657614dcb1c6e556ec709a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2678/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6b1aea4944332af7c93cdc2b888c13bc81446ff5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2679/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cf64b8a5eccd9b452c177fd6f00608880b663573 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2680/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cb2a783ffd0d2fa1c8bec3fb738098797a8586c2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2681/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 87e66448c75c9928b2be806f42835086a919b19a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2682/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dea0ae8ca1e9a1c2b49654614353fb460a3abb3e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2683/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From eaaa429e53f8caa918a1eeba7711bd9f4e4df92b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2684/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 38dc29504763801d0446dc3b35ce7b5d27f5bf5b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2685/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ee8f3e51a38ebb0857b1280f7cb8b2f09a4d5557 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2686/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 932be8bffa8647023031a6edc595d91a84d3ae2e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2687/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d0cb87230497ebdad4bc4248cc42d13cb09366e4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2688/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 51844c2eafc097d9d6c510b06f9aecd93e9063f4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2689/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 951756802c011155fd094fe8e63cc33c75bc0aa4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2690/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 95436d4a83804bed77d6b0f202bb966c25c42c31 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2691/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 66b50f9e233b0c755d3be079d06c1d52d89cbb02 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2692/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 160be31eb026e6df8949ef193f673928166afdba Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2693/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c087f73ccd45ea22be99596851fb446cef8ad6f0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2694/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8d3ff36da65790625097ba20a665bdb2b0c7bd5f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2695/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dddb72f573643138728d2ed151b1f1f3364bbce2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2696/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3d6d4a375775cb4b282716838eb965786fae4035 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2697/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From feba9f682b20db565d4f78b285bc5a01201b0e8b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2698/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8a0668934570f89953a307c5c6a634e9b6691398 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2699/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b161e40c1924c0b4ff2c64c33cf801692ebb9166 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2700/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 078c8e40ce477e9c2fe91dffb336833380dd7c2e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2701/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6b44c3dbc977ac46693a389d3ede55076e058646 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2702/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b2d92b456cce468cea657b0dde3d4bc0e189e557 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2703/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6e6c948095bce721356ed5e4d6db7893fa1c74b2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2704/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 563eca4c79704222ca4963096f3caa4c721a86fa Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2705/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b9e46e005d0b40f006af53d6fdc48f4765904771 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2706/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7005bd76064e675963ee4342775fc3b4067732bc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2707/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 10e47f28df5ac2c83c1935440416913558a6f6e9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2708/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 09d43ad54006db4aa0c25a63a9a2bdf103e555f1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2709/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d7d78ac871db6e409763a7b7fb7ac35b2cfbe238 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2710/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5f289e76fc5b7ff58f6f6828e7f5ef36c382106b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2711/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 19bdb5866b2b96b84020221b2044d664bb855a0f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2712/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c57b55688f4a818c239b6b6d24946beafca8d8e6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2713/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From da0a423ea1f3956f180c5cd47522ef87f9b682f9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2714/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ee02b2d3cce7c631b67a596ec7d08cebe267b0b1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2715/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5bc2fbf1267653d9397e48a920afb1826398c30e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2716/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 77d7f23d2cec24d0baae91953acec2c4c33540ec Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2717/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 04c445093b74f4d3bbbc7f670defc3c80c48921f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2718/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9f365c78f879f8d26c130f0907a7a3215f0e2182 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2719/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 73f23f4decac7ca905d643570ab5ebd0a163397b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2720/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0113cec4ba7a226c95e0a59591307c5e53d82729 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2721/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fee6d48c40fc126d75530ecb5a68c2ad177d9dbe Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2722/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5c580d0fcee58d8c7a7be8b330ee1e0e36ec4b8a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2723/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7af032a26bdf87eb8eb08ed4b2910f71d5eeafbd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2724/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0fa8fe1d212ebdf4a2fd0adcc40659c8f9d8fb36 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2725/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c973a1aa1178bde127a850f3a3e7b5808bf6bbfc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2726/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a0588c63819d6df3045047577e9a0e4e5da9c08a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2727/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cc65451b362f99089cb008e4c70a8eea0d1ee0df Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2728/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5c83b6c0c5b08848628ed8773a5326a68a15582b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2729/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8fea4713f8ba625a5049190cba5d9384088c9d35 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2730/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 77e3c188709d44b30aee9260428580342d84cbc1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2731/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 96cc87f9f7baa4d7e5c666dbcfd9cd595c21acfe Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2732/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a5674c340f57da1d8eae1237ef241f53bdc86e05 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2733/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5a80a1414307869246c29c1900b970bb66c0cfc3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2734/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 51c8e914170b97f9361004e40e0c96821360f7da Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2735/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8e8b770d5a7ed069dc3160023b5e861adc805067 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2736/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c64594d09b22346c67a7513d20a59c3186f3df41 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2737/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 51e8adf72d6627b22249a3c640ca31e19590ed92 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2738/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2104edaaec0cd1698b4b4f8a368d908903c061ed Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2739/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9843bdc1a6fbead3c33d84fd30d037bcd1135815 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2740/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f63186a8aed01cbeedd9247feb35f607438ca6bb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2741/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 32c7ca75eeca32e65446e7c215db012d5cd894a0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2742/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f36b56e8147d193c88f9a070ee67d13eeaa2445d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2743/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c3f0d0d19913b32ee5a358b21dbdca5e90801a29 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2744/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9f515a38a106d651f309a4411477d9e8102c791f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2745/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3b7678ad3cdd683992bd1344029445cf0c0b23f6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2746/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5502664577cca6476cb1d1e1a498655e469a9c66 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2747/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4c41c07fa10ec9a48c52ce90fd696481fc67abc1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2748/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 87b413ce5e8b5d42c1e75607bf2202e231279e67 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2749/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 629393f410253148efad8b3652e371d0f9872c8f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2750/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7049595a7543508c6e515aa2e0edbddaea67ae1d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2751/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b1daeaa4d391f80e9bbc01bee0ed22dcadbb284e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2752/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ef0f025ef008fefd73db0a39d0a73085029f4f63 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2753/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a051aec5f29cb443bea80089b3ce0f9d9fc6f26e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2754/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dbe55e602602006db15850dcd67100df3e97eab9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2755/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 54224923231aaad538a186136877e5d1f25c94a3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2756/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5583d10f6539bfeb8fbcc9e318f9bde10386a0ff Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2757/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d0347eee579e86cc04e9d636fc08cbbca9233ad6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2758/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 45f8709c26101f5815023bc765020db6da0628cd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2759/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c077b9a76343b0083ac1913952d93442d1339330 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2760/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0e69b08f1e6410d3b59fc9b5f568193fb99fc9fb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2761/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0035c19850b898c2fd4e2d82430e42a0a97552f6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2762/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b24e16f0c11b9c89170c7d89d7adc466eee14bb0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2763/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From da1d92454d654c5fc47cb89103db66d3c26242f5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2764/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 11577b7ae9cceadf7b696a6309fd5703c67f052c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2765/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 728c89cf9d10242d85943e87c9801ec398dd2377 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2766/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7e705eeb5baa4349a192398dfaa666a89f5d7081 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2767/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From afb39ccc9c6f40777d7fa95bc41e81a90acf4a8b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2768/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d134992ac46cab90824e09c2595e6855affde175 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2769/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c246938819c3e6d492f83a2f732e58d1b1f22b58 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2770/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 268c05194929650a57c36c8576b3694f8bae3254 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2771/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 201a243ed0d68ae38d29608f3e542e75ab064d55 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2772/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e979d101a09ad3b3d5cf31f453255f5162b5243b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2773/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ca44cee6fc09a9c42fef5b83b0352bc9f7979c94 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2774/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fea6e934fe6f280a1fca6f3e4c2fd359779fc999 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2775/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 27d65e32d42a8ffbbeb090ec01b7422eeb11ea65 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2776/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 649a4cd2787588223afad8e91762bccc3b8607db Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2777/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 058c54cde0dba50627341534d64c9c1b16fc58e2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2778/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6a8eeebb9b3a146e60d33f6be8f105979610468e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2779/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From de3476e35f31188dc3275665b53c7e66a4744154 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2780/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f6c09ccf03cf58b04d94ed9a75f6b44a7fef5c60 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2781/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7a60df994316ed5e3b9f10cc9de88c2d8e63d6e5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2782/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 79b8c4ce3d14a1fed38ef16ebe3b0780e43b406a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2783/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6bd02c9d281980e19b570cd6739bcf528727a6df Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2784/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7e827cd85dcc6904fcad947aeee260a2f079ad67 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2785/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From af0310d67d3e136ebafc85306f48f6a612cedb0e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2786/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e5d17e9d589b2f871893a751c9bfc75b44bd3eb5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2787/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 42cf964aa728ddb8d0d1f87038711a0cf4f6a69f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2788/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 39a69456d20b9597c12a2c16d3382caa70722cff Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2789/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 560415588476ff1eefbec477caff01aa62a6d678 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2790/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 56ef3e2145296831abe3cb852a6b68cf741949c8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2791/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f725992a9e625490606b1a8ebc9035771f118565 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2792/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 12c418ec96747c267541d76aebaa8e7a83771055 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2793/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From bc426bdcfb3038e496c0bc8866c1f6b87e6c301c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2794/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a74aea0ea222cc21ab683f4e2aa492d71b4c8043 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2795/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3169847ce2584e8da30f36f2955da800ba666921 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2796/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 73afaca079dce5a728af3affb8c45072f71ddadb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2797/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 76f05850446ff4efac3dac19b742d7420ffbf518 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2798/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b5c768a55b26074189586b2af2115731219623bd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2799/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f3a1bc2342aa4f0812f92136b6527f324d04c4e9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2800/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 72588eeccde4905d805cba81007c06fb7d5d8976 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2801/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1be9be489c4762cb39228448c92515dddc0a8520 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2802/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7a2dcb3ddd659d679f76d98e26bf57c741a10df9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2803/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 008806996207fee97691e8f923b814bd2989e036 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2804/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 034d23b2491c8bd62f6a5629cf5e41cc640f8a1c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2805/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 88d1a3625989ee1f12384da58f6e8fb1ff5d662a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2806/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b87e6776b3d10c4f50bcebce0ceef8a9ba3da364 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2807/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 994eba81211eb74ae1d79cd153dd0ed7de66c631 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2808/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c2173908dca13392458cad9b158f8f4e504faf1f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2809/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 49d490078caf420d51305646e76235c93566dce4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2810/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 771f21e7b606f22c1633e2f0ff4154b738dcf925 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2811/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ca2244771773005b6b178f5e34ba5ea7107fc720 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2812/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From abec2c56ddd690840a79f8aabd8a3aaf07c19cba Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2813/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e891ab071a06df3e6aef1142c4c7fe8d8048c3c1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2814/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cc3e3ec2e5e6654aa774fa563683868b17f3b342 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2815/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8bfc39b73fda9a5ebedd3ff2bc9d63e489501719 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2816/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e16fdaa765606cc391c5f4cc79c63950d54bc518 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2817/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d0900e93dc2f825f7eec704e5df8bb4a67c2d4a4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2818/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 27892f4622b374fcb73d877956c57ef546aa7b74 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2819/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e6b85d0926e10eb6d2af13497c62309f47ff595f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2820/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f673ba303408866598e517e380e54e27eaa21235 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2821/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3c2f8a7f9676f9312614857776fb3e1826b95443 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2822/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9b7e02ca99b077cec812cad48769118dfc1429c2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2823/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ccb6e560d68c60b83bc0ebe91b3efcd67409961d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2824/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1a23fb3cd2da34275444996d0aa0cffa7098aaf1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2825/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 37273098045149ea6fb8f8dd42294d0ca2dfbdb9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2826/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5a48077e037b0e56cac9ff195db4f641a09ec484 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2827/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ac18c7a57f344d81608d456e645f1dd36e55b2c9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2828/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1145a7edc1d107d8d941a577060fbb79191254cb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2829/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d0d2bddebf4df6d558e123d7616892d0847ac847 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2830/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e1183532e26c6dba67d384a5a7acca3da833e907 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2831/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 01306afd8580320f5f8a939902d6c5c6bf80f1ef Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2832/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f1bcad6f1cc2450be38e1c8c0d87db76ba259953 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2833/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0266392a3df4703a61aca5d25ccba3e38f3a1d42 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2834/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 61998bc7553a174f6545ae08479248ce7d071c70 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2835/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4647e7b4205b67c8ccf392f1aa637eb3aabf987c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2836/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 431cf975a3206b3c4a8f44a91254e4c65451d0fd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2837/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9d26bca9be7a46f5a9765179dbec1d36cf8e3049 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2838/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d4278f068657a13109147300cde1624cf32ca10f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2839/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 769d2166a59675013daf1f9937db17d246d9c144 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2840/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a4b4159c1011c0a7c1e4c6473042f4ce836bc1b2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2841/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1bdc0da13cccb8ff3ac8554f21ac808f6882b93d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2842/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2d0a7065f77d9f12170b448f3d1f0b1cb7a1154d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2843/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From af737b469c468f06bf1494179f80cc6521adc2bf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2844/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9a10cafa938f2bc82bd6d12228a2a5d17efd31ad Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2845/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 694ebddcf875a320aba4472fdef742f048f3d4b4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2846/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3337c2d88cc0be66f1894a0696e9f4b2fbed6f23 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2847/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3fadd569dceb32237e2bfe5c5aff0bf1cd81a7ef Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2848/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 44cfdd3d5ede94a0317034157576b85578e6a286 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2849/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 03b792bf3f33c927ff0e829db1136261a95542c6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2850/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a5aa946d8d35d6685aac13570cbef65d44a09785 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2851/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f8daa44b42ada1378fbf5f558346ce478a4a2756 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2852/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 653faff33bd4ececce0b776d7d3ef188f69543e2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2853/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 03b719227087590a47ee63c4be9bdef70352efa5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2854/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f620c1d066fa391f89e4768c0ee15d015cc1dfe3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2855/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 04f544b49aac3ca0e1855df4dcfe305024d46208 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2856/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a6f3df931d5d89205c3f9dd08001c994ae4441cc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2857/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From feb3d46ccd39bd18b4393310c035a5c608a64289 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2858/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From add4c9818fb91d0b62593046a0cbb5ff8d40d59b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2859/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d5fbf748cc0fc4f1484c6fc5561b5fba24db7456 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2860/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b51204261c8425c2868462410834cebfb86cb2f3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2861/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b4f7761dcc1aaeaeab2f0588e3a083a0bd491da2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2862/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b3701bf88d45ff5aba46a3adc41b56bb0412d9d7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2863/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a5bdc984ba03e5a6dedc0ddcab71ee2c064c0f15 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2864/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0f21970bd6153d76853e61c00c821b8cbc3d8a74 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2865/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7fc824260cd65a85ed9fab98cfb235c8ef455697 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2866/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0b337d092113e1d0a498be2a465a757fd49e296a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2867/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 226648da94c2e35a05b7eaedb2079f426ac4cf4e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2868/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 92392b89d6964ae206f133a4507f809714c368ea Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2869/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d9b57b015aac7254fa846075ad6598ef63ae9966 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2870/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 340b66907e7fce68768306b9fc05e4a6e5e5f168 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2871/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From eb12c4c530675dc2469199c2729bebc8906ba8b5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2872/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e39d7a1b2742d7127f5197b9c2f3599418e9ce71 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2873/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 01992887180da07800599f77d76f25c8275a17a0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2874/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7b35fb94d63a0c49ca72e79f4bd8ff066c14e6b1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2875/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d8759fbf5e5d50883e469edde86622f74f79c828 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2876/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 487c1c30fe4381f78af4d3406e2028801f3cb161 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2877/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2b9afdceb7f77b6767283ba50768544e955b65ea Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2878/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 28dfafd24927fc84b18e00f194fac2f6b8c7a2d3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2879/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3ec8a09c5d37ee4f569b4e8c3f8fc4fa759ef17c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2880/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d79c241a6952e8197c58f0417c3e66398ff43d72 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2881/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0a4da94ccf78cdd3eb159f7f43d9807b80d1681f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2882/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9df3f80efb03893a13540fbbb0c7a224c27f83b0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2883/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4d7e99b94b6440e358ea4fcfa93f615c8bd90015 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2884/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d1a89fa321c039ad41aac2ecd9ace2f6f240ed41 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2885/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9b9ab40e095e805ca68c619785d621eddc0c27b9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2886/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c15bfd21e4dfcecc1bd5827784eb1f3f201d8a77 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2887/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 15a285fd83ab3d6088837520533873cf67140ee9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2888/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1755941a040ec05f839e7edf81ff8c56f5ba316f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2889/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 646b7ba0cb27883870e36ca3d1bf469045ca1ab0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2890/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c7d787f1a4dc5ad3e1aff6416ac581ff00c8d3e6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2891/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 20dba466a8d8592ede10d7445f6815cd0a851987 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2892/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4843b28e4d011d0ee706871261d9538dc7d7b054 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2893/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a1abace60c482db754c5a5abce779a500ba77993 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2894/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 57eadddf06c1c90955512c3d80c305b8970e0bdd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2895/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From aadf89f0da6443bdfc3726c8ffc6a9323bd3df78 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2896/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 708639780cd08ca928fe1780443615fc47590228 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2897/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 98dafc19c254733bc8f44cda8b2e65835eec19f3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2898/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 18a7e6f3ae50886c6899352bc4c6d928918b9b2c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2899/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fd4d48a26db681b4cf49ec3ac5e02aa168114f13 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2900/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5c1ac498c2664e3a706a7e97224fbe71e0e4c289 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2901/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ea1e54b73dd469c10eabe736f088264d1f38ca1b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2902/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ff7ad2e25729606b040d3201181d3a0624d10dae Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2903/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 88be6cb13068e8d3818ac4bdf954bcfa3cde075c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2904/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1b3edb2500b66882d48ec3b88300381b36ec9c21 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2905/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4e95dadb10e7036ed9dae33c6b7b8e80a7eded68 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2906/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f8350c91dff649a6fff4feb5cf5a30065dec3759 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2907/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 392b64591db6d4765182ad419214d56e29f658f2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2908/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b5f0ca1af498f7ae596ad3dd69aee4d515aa83bd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2909/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1dde510ce8a45e2fc4b98be565c0c2ab8b658923 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2910/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 346e1badffe902b325757c62a7dc294419e4c46c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2911/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 11ae5bd1b104310f551a9086710a32c861b86fbc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2912/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 75746514dd850e5fbf8344058e64d63e1f3cb237 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2913/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0e79495a39882377983e1bba55efec52510e7004 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2914/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0f68b299b53e55f600577f012afc235b7ead441d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2915/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3af404b3d6918da09bedf0a44b9f745c6df4b15c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2916/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d46c220c825233d511e1cf29edf53d3a1fca73ff Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2917/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b4667da73ce8524d624bce34840f0bbfc63fbda9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2918/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0c1a38987e87c397525bb53a2fe21a145c50a642 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2919/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 06f0e4352229681bc12586ddad2fb20b73d53976 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2920/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1ed0d86f097992bac6e5ba357338b9a1ef2c7af9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2921/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e2ac88532d4a3d61d4ec77cb1a5736d44f9e7d27 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2922/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 01eae0e460f4fd5ff23e243a59d9e61d352851d9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2923/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 87c53410fcc49c04c1f095e3fef60c0c696cde69 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2924/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e8894f29b1e6cf58f329c89088e2dbd562f54b28 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2925/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 459de72306f2b594bf4f9e1dfbcc523d438a8ba9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2926/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fc0c2109441aebb8a5dbf920e3c2f890bf602096 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2927/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 361e4c55b2de7e87a1f8164c26b9aee6b2004dab Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2928/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fd83e36bf13a4685b3f4ddca382c044f099c5bc5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2929/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c3fc94c306b326a1d53709360f0a3567cb9f0cd9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2930/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 31d091e334b1d8ede7c0b632341432d9bd82667e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2931/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b2db6290495debf8e8aa359b423a94a4d01abff1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2932/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4eb664070ce00aa84beddd5ddb332c1f7aaa3efd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2933/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c27fe144ed2a551ef7b59ce53f534f474b996190 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2934/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9d61e6c13e24930771b88cfd0213cf09be8667e3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2935/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 692afa764d35f3f46213e400f348ce76bdab961f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2936/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0b675a6265832d5bb9a4695003c47cc82c64061e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2937/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5231e2d058c32577ca3affb3f61963e205113aaa Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2938/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 35381aded84a9cf7a46d080396f3fec06174ab11 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2939/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a5ae803f0b740cc75dccb070ede63a5adc2e1947 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2940/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 53a4b52915c02da6814083d6f28201a9c114137d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2941/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f1ad504ae0d84325616a7c462ac2a23fb242cbf8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2942/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fcabfe52fa9873fa2b51a66db5dd8305a291a35f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2943/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b2e80b0e1de0adefa0830039311ba305579bfc0b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2944/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c1dcbaf14bb6268877b32952a67267cbc607cd58 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2945/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fafbc5340a1aaad027b801746ed2d87920da1337 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2946/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e9903757b5eb8af712aef513ea54c681911dd16d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2947/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9c6383371765d51e5195e2973b7be116510b1de5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2948/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c25c97779bf1ddca017d6c718ae27e5aa87f5cda Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2949/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 82b461ae4bbbf2302547c6f4f746607f0c7d0a3e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2950/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ab1b6650f83a77906c2fc054852d0b20f0f85d2d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2951/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From df1f4627184cb36ee1e3f940449625cda1ab06bd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2952/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fb8195908e3d0e52013b3846891278d23e066bb5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2953/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 08a4d6694daed1b2c625f19dc8cd4fca89ed5b4b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2954/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 87fe9a7f1612f4711f7e6be19342c675ce105699 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2955/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8ecf4289ecfb685b615bb8656920e2b8ab3dba5e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2956/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dcb1a3b7f27693d6016cdb3058760230006c6e82 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2957/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 65f87e4ded57aab6974f9026c8bdafe337c467b8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2958/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 03d037685ded430d0004f4e258b4638bb355d3d1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2959/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c9ca25b6748a15aa912f77683bf4f2f73983bbe5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2960/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e00659d3516fc4e365d3ae320673fadc34b83cc0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2961/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 688fa6102687f54814a289783b1feeafd748406a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2962/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 58b1cc8cd2afdaeac10e79101672aa3f9ade5630 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2963/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3291ee1a7df903f693bacce46681c5af1736740d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2964/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 4db3c38dfc38ce816ab1385c5363e41133bdaf42 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2965/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d5b726b38afe5456ca8f361d3cb7184f845be806 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2966/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 313a418bf63ae2b2f56484119433de3335e1415d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2967/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3d48cbca1d581385c5929f28d57ffd5ced430ace Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2968/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 799152f32ae92e8c7b76f39ed0fe9acf3f645d66 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2969/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d7bbcd804bc8e81bfbecc0427ce66f0f9a46f0bc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2970/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b1251afc8fa9f1d5fa855cc70cde92cde99aa01e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2971/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cd6aaf5fe1514a3db221975b5e7a9c3444c0c378 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2972/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d5795b5521994448bda1158d9ec7a48fefb01452 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2973/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2705141b76d280f3782149a7deab75982c311974 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2974/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 67c888a3c46ab1c7626bd1d69a1e604f0b3b508a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2975/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b0790ab71ef19e1c20e0cee4143a1a6eafd6834b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2976/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 23d5c914e420ce99ed1310e08492ce54c49ed65e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2977/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e0b1573e1a81e424cd1e1c639217b3852cb92fa6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2978/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3de51c313d7e78885a85b61eca228fabb15e8567 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2979/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2eb7ea48b98115b9f93223ad39b9f5a4ad3f83e9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2980/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3c1b4029093b94d49e42eb63e6b651c1a39cb9d8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2981/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b54320ea93b08331b85cd8956975ff9118c9570a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2982/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f261c3e56150a1983cf896fa352cf46c693e6c30 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2983/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3018a7154ad8d70ca00a9c337d157170648af769 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2984/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 516a79ff0dfcc79fd1bb074222964ab8233ae7fd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2985/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 805b407f7e5d26d7600ca16c3067d67a1a0b3994 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2986/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c72dae4f77c9773d54da34872dfc12823178f4e7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2987/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 253fbc130a68e73d2583c6e08cf82ee87d8f70f0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2988/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From dd5ee411490e1f55efdb390a47503acc4c3c8cc8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2989/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 15580734f29655989c51a7a48b5b2f08c3c73a7e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2990/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c94e754b7a499c4078bae148333e66ca0053cfd1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2991/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 66a9df307a1bc01cd079207465e87f34e961757c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2992/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6d093fd656d5a5d8843ad84e3e1d752732f8343f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2993/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d019af4646f3d8f7168cf0be15e8bc64aa816bf0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2994/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 52d74f0d6f6a5399ba5f9dae3a7b906dd2df043a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2995/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 85927dd623438d34e500bf55f9bd54518f11e621 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2996/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1ce2f5f8a4474e71dc57ce7d4e4ab19f30542efa Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2997/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 16e6b4744e74905c20a8281ecb8dc0bd5fdce159 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 2998/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7f4251d41f97d8a8b777376ccfd4b36d8d756745 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 2999/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 284b48428db97dbdc14058b4d50cbfa2842219dd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3000/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f60124f9c16e4429909680a3b36d3a52120c213b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3001/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8134a52528847e954d2526419662102d48a3ca5e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3002/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 152b05549361a160acd0205b657476733cc9f7c5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3003/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0f2a584477b4e12bd743a37cd9d1bf4ff6083ab7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3004/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 3615356c58ab0d5a7c5fa60ea6394ab134d56fd8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3005/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7c67ec9268f19a48b62fd7dac9ee0e8751ebe122 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3006/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 44942e2507e9f089722c5682cbc76c5a47f213a7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3007/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a44c0ca69c4fdf90c03a35476fdc14c0ff897df5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3008/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 70ca45bd95ed437625118bd0e71fd279c56c9258 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3009/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 04c116080826f7c3f6fcddb1e7f6a0e8d27e3d6e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3010/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1c57dcd55eeb30e8a25f1b03ec040397ed7cefe4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3011/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cdf8aad5b90c198cb7d075559af3373ce80d5e16 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3012/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 9241447175fd195058f61da8f4936fc9539f8b87 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3013/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c8040469838157c1f10baab5fa27d5f41409001b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3014/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 14015cfd36cb8461fbd17c9266174a96c7e37590 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3015/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 0201159c395ce97c7d6e8533ec28b7bbc50332b0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3016/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b552765ffb07bedb16e4b80de29236c56f915aa3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3017/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 874d9a4fdc5d1021d9c48d6ab6306cc11616e1c6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3018/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 945f971667e1299fd61ecf0096f0ca99bb3b9a67 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3019/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 7fc762f2ec849ff2e67e7a2e9fbe0e23c7dba360 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3020/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5664cec276144021c07338a3547b65e252416fdf Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3021/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 8203f6e7838cfb8eae751375e34f4e21ee552812 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3022/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 45fa4cb6caade6229f51138a1297b06789fd2394 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3023/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 59f5d7b36aa9a6ae7a1974b9ea7ea1f2c50b0f57 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3024/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 28040e82f78d7f2fa7c8328c96b392f34cc6e9bc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3025/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d2871044bd950b6e22abd2b8080b36438f4297fc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3026/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 47847f8a34a58ce3f9bd38b2bc712b5d3068a5d4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3027/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f9f026db1bfd278e901b227279f8dbf91fccdf17 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3028/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 51b85f3db3fb81ae527b4f12c7d3213500e420e2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3029/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a9c89126f01295c583e49e153c8e3e46fd401305 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3030/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f454ef4e0a273b46fa681735f3c8538a7ad5bdb9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3031/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 16ab3a0f1c83aa0b28659a0c2554f611197239af Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3032/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 6ddb6b37e14a91450a1234c94c1486f2548cda97 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3033/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From c928177cdeea55154954b449beb69f882ea6aafc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3034/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1c2b13da842c1f8454cbbd9e7cbb20037281ba12 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3035/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5cce227e1d2b54ce8ac3a002c07b2e26d266b078 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3036/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ab93ae51c2da60b65bb1a83c2a7736d026b7429f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3037/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a980cefa81eaadaaab59fb55b3758bda6cf8c471 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3038/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From a6f481e20eba1e34dd827a8c9420c119018ed763 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3039/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 181e4395a1cd179dfee5256c19bb5ac710d9bb6d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3040/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d7ed25b1e4a1706f897b148e76dce17cb3407a4b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3041/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e673dcea49965015d13f66a84cec427ce99ea2fc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3042/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d26be3b7afdefd6535f6e2cd6fdffa0db3136e7d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3043/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From fbc59952c4a9aad80e0a5530828e0fcacee0648e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3044/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f6dd999860a1fda759c448c6d6c3b095f90545a9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3045/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2f9f8ae1162c444004cdabb4fcefc5117eb8e819 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3046/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From d5724273e00d1cf7f6c8ec593fbccd3ac638c55d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3047/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 60255f8eaf034a5cf101fb20ab4463fb61c91bb0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3048/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e5159b1df604ec2ca6bfccbd99997d802d6075e7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3049/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 2d1e478a45a44fc442d87b3b29f41787acebf2c0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3050/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 94fb8063329f1419abd023fa0c4f24d4f7b16dab Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3051/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 66a9bbc0d61acaede7f598bc7551ef4845241d54 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3052/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From b96feeaa1b7646edbd4b410093d0ad3d65c4fcb6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3053/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f6c2e152393f026e37e36ec90d0cdc8cbf2cbe67 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3054/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 73fb3255eccaa106ab4c7c0eb8a8ab0b0535d507 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3055/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ee1c65dd2fe795cf73c3fcce4ca4b6d21a45896d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3056/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From be4f809e2ba52fff6a9de0162fb746d03cc19d65 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3057/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From cb9d7b2c36b4832a5272da53e563d0f00a66c94c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3058/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f2aca0cffff733958e075633004a94d943d0ad3c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3059/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 86807627bf0f1992dbe22a3bc6ec1e9d058b80a3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3060/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 316531141073df6330e9ef2e7d01f41efae8f210 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3061/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e16255123cc0c4c6388b515b0361ddc914935abb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3062/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1e34c76ff71e1f5ceeec0128d538ae8a3a686543 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3063/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1fb33434550c1f8b4c16666d4ede893ade2bee07 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3064/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From ee98d7b3541a08a17bb30da2f85451d15d6158d9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3065/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f154c829d6f52507f3bc2387b7a238ca498bd07a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3066/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From be35750c9f2da1d38c54819d3b039ca395cb05b6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3067/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 27bd9200081091bc7e3e16011248fd74610182de Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3068/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From adbc0c4e44166bddbf2cdc3d0e140e9fbad6e453 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3069/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1dfbeb25029ded41a2552a9025abbbc402cccaa2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3070/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 81a0eaeb19d97b61ca3a607878de169fa2b4c673 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 3071/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From e8e54d4e0c4e2b5405631094dac487cea076c381 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 3072/3074] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5a502e1dadb1b6b191a07cb09336984988d6c9d2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sat, 5 Jun 2021 10:59:08 +0530 Subject: [PATCH 3073/3074] Support for s3_object_acl --- ...source_aws_acmpca_certificate_authority.go | 4 ++ ...e_aws_acmpca_certificate_authority_test.go | 71 +++++++++++++++++++ ...acmpca_certificate_authority.html.markdown | 1 + 3 files changed, 76 insertions(+) diff --git a/aws/data_source_aws_acmpca_certificate_authority.go b/aws/data_source_aws_acmpca_certificate_authority.go index aaf324a18dc..7caf8ca0a6e 100644 --- a/aws/data_source_aws_acmpca_certificate_authority.go +++ b/aws/data_source_aws_acmpca_certificate_authority.go @@ -71,6 +71,10 @@ func dataSourceAwsAcmpcaCertificateAuthority() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "s3_object_acl": { + Type: schema.TypeString, + Computed: true, + }, }, }, }, diff --git a/aws/data_source_aws_acmpca_certificate_authority_test.go b/aws/data_source_aws_acmpca_certificate_authority_test.go index f57803c9c89..8cf446889fc 100644 --- a/aws/data_source_aws_acmpca_certificate_authority_test.go +++ b/aws/data_source_aws_acmpca_certificate_authority_test.go @@ -43,6 +43,45 @@ func TestAccDataSourceAwsAcmpcaCertificateAuthority_basic(t *testing.T) { }) } +func TestAccDataSourceAwsAcmpcaCertificateAuthority_S3ObjectAcl(t *testing.T) { + resourceName := "aws_acmpca_certificate_authority.test" + datasourceName := "data.aws_acmpca_certificate_authority.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acmpca.EndpointsID), + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceAwsAcmpcaCertificateAuthorityConfig_NonExistent, + ExpectError: regexp.MustCompile(`(AccessDeniedException|ResourceNotFoundException)`), + }, + { + Config: testAccDataSourceAwsAcmpcaCertificateAuthorityConfigS3ObjectAcl_ARN, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(datasourceName, "arn", resourceName, "arn"), + resource.TestCheckResourceAttrPair(datasourceName, "certificate", resourceName, "certificate"), + resource.TestCheckResourceAttrPair(datasourceName, "certificate_chain", resourceName, "certificate_chain"), + resource.TestCheckResourceAttrPair(datasourceName, "certificate_signing_request", resourceName, "certificate_signing_request"), + resource.TestCheckResourceAttrPair(datasourceName, "not_after", resourceName, "not_after"), + resource.TestCheckResourceAttrPair(datasourceName, "not_before", resourceName, "not_before"), + resource.TestCheckResourceAttrPair(datasourceName, "revocation_configuration.#", resourceName, "revocation_configuration.#"), + resource.TestCheckResourceAttrPair(datasourceName, "revocation_configuration.0.crl_configuration.#", resourceName, "revocation_configuration.0.crl_configuration.#"), + resource.TestCheckResourceAttrPair(datasourceName, "revocation_configuration.0.crl_configuration.0.enabled", resourceName, "revocation_configuration.0.crl_configuration.0.enabled"), + resource.TestCheckResourceAttrPair(datasourceName, "revocation_configuration.0.crl_configuration.0.custom_cname", resourceName, "revocation_configuration.0.crl_configuration.0.custom_cname"), + resource.TestCheckResourceAttrPair(datasourceName, "revocation_configuration.0.crl_configuration.0.expiration_in_days", resourceName, "revocation_configuration.0.crl_configuration.0.expiration_in_days"), + resource.TestCheckResourceAttrPair(datasourceName, "revocation_configuration.0.crl_configuration.0.s3_bucket_name", resourceName, "revocation_configuration.0.crl_configuration.0.s3_bucket_name"), + resource.TestCheckResourceAttrPair(datasourceName, "revocation_configuration.0.crl_configuration.0.s3_object_acl", resourceName, "revocation_configuration.0.crl_configuration.0.s3_object_acl"), + resource.TestCheckResourceAttrPair(datasourceName, "serial", resourceName, "serial"), + resource.TestCheckResourceAttrPair(datasourceName, "status", resourceName, "status"), + resource.TestCheckResourceAttrPair(datasourceName, "tags.%", resourceName, "tags.%"), + resource.TestCheckResourceAttrPair(datasourceName, "type", resourceName, "type"), + ), + }, + }, + }) +} + const testAccDataSourceAwsAcmpcaCertificateAuthorityConfig_ARN = ` resource "aws_acmpca_certificate_authority" "wrong" { permanent_deletion_time_in_days = 7 @@ -75,6 +114,38 @@ data "aws_acmpca_certificate_authority" "test" { } ` +const testAccDataSourceAwsAcmpcaCertificateAuthorityConfigS3ObjectAcl_ARN = ` +resource "aws_acmpca_certificate_authority" "wrong" { + permanent_deletion_time_in_days = 7 + + certificate_authority_configuration { + key_algorithm = "RSA_4096" + signing_algorithm = "SHA512WITHRSA" + + subject { + common_name = "terraformtesting.com" + } + } +} + +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" + } + } +} + +data "aws_acmpca_certificate_authority" "test" { + arn = aws_acmpca_certificate_authority.test.arn +} +` + //lintignore:AWSAT003,AWSAT005 const testAccDataSourceAwsAcmpcaCertificateAuthorityConfig_NonExistent = ` data "aws_acmpca_certificate_authority" "test" { diff --git a/website/docs/d/acmpca_certificate_authority.html.markdown b/website/docs/d/acmpca_certificate_authority.html.markdown index 1b456f10e1e..d65d632d7f0 100644 --- a/website/docs/d/acmpca_certificate_authority.html.markdown +++ b/website/docs/d/acmpca_certificate_authority.html.markdown @@ -40,6 +40,7 @@ In addition to all arguments above, the following attributes are exported: * `revocation_configuration.0.crl_configuration.0.enabled` - Boolean value that specifies whether certificate revocation lists (CRLs) are enabled. * `revocation_configuration.0.crl_configuration.0.expiration_in_days` - Number of days until a certificate expires. * `revocation_configuration.0.crl_configuration.0.s3_bucket_name` - Name of the S3 bucket that contains the CRL. + * `revocation_configuration.0.crl_configuration.0.s3_object_acl` - Whether the CRL is publicly readable or privately held in the CRL Amazon S3 bucket. * `serial` - Serial number of the certificate authority. Only available after the certificate authority certificate has been imported. * `status` - Status of the certificate authority. * `tags` - Specifies a key-value map of user-defined tags that are attached to the certificate authority. From a5a27eba6f9f168be809bc99d7a2ddc9b788d283 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 7 Jun 2021 08:56:08 -0400 Subject: [PATCH 3074/3074] Add CHANGELOG entry. --- .changelog/19681.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/19681.txt diff --git a/.changelog/19681.txt b/.changelog/19681.txt new file mode 100644 index 00000000000..20b49f86803 --- /dev/null +++ b/.changelog/19681.txt @@ -0,0 +1,3 @@ +```release-note:bug +data-source/aws_acmpca_certificate_authority: Fix `error setting tags` +``` \ No newline at end of file